Category Archives: Misc

Miscellaneous class in Java

A buffered character-input stream that keeps track of line numbers. This class defines methods setLineNumber(int) and getLineNumber() for setting and getting the current line number respectively. By default, line numbering begins at 0. This number increments at every line terminator as the data is read, and can be changed with a call to setLineNumber(int). Note… Read More » class in Java

This class implements a stream filter for reading compressed data in the GZIP file format. Constructors GZIPInputStream(InputStream in) : Creates a new input stream with a default buffer size. GZIPInputStream(InputStream in, int size) : Creates a new input stream with the specified buffer size. Methods : void close() : Closes this input stream and releases… Read More »

Minimum cost to fill given weight in a bag

You are given a bag of size W kg and you are provided costs of packets different weights of oranges in array cost[] where cost[i] is basically cost of ‘i’ kg packet of oranges. Where cost[i] = -1 means that ‘i’ kg packet of orange is unavailable Find the minimum total cost to buy exactly… Read More »

Count Pairs Of Consecutive Zeros

Consider a sequence that starts with a 1 on a machine. At each successive step, the machine simultaneously transforms each digit 0 into the sequence 10 and each digit 1 into the sequence 01. After the first time step, the sequence 01 is obtained; after the second, the sequence 1001, after the third, the sequence… Read More »

K’th Boom Number

Boom numbers are numbers consisting only of digits 2 and 3. Given an integer k (0<k<=10^7) , display the k-th Boom number. Examples: Input : k = 2 Output: 3 Input : k = 3 Output: 22 Input : k = 100 Output: 322323 Input: k = 1000000 Output: 3332322223223222223 Reference: The idea is… Read More »

How to write Regular Expressions?

A regular expression (sometimes called a rational expression) is a sequence of characters that define a search pattern, mainly for use in pattern matching with strings, or string matching, i.e. “find and replace”-like operations.(Wikipedia). Regular expressions are a generalized way to match patterns with sequences of characters. It is used in every programming language like… Read More »

How to read content of GeeksforGeeks in an organized way?

We have been trying to organize content of geeksforgeeks. We added below pages for this purpose. C C++ Java Python Algorithms Interview Corner GATE Corner Data Structures The above pages contain all related article at one place, but do not provide proper navigation through articles. GeeksforGeeks and GeeksQuiz are quite limited in functionalities which motivated… Read More »