Category Archives: Misc

Miscellaneous

What are the benefits of interning as content writer at GeeksforGeeks?

Content Writing internships generally are available at GeeksforGeeks round the year and open to all the students who are good at article writing and at the same time knowledgeable enough to write about a particular topic. Most of the articles that get published on GeeksforGeeks are contributed by students and working professionals only.Our review team… Read More »

GeeksforGeeks – Official Partner of Pragyan

Pragyan is an ISO 9001 and 20121 certified, student run organization that is hosted every year at NIT, Tiruchirappalli. It is the largest techno-management fest in India and provides one of the best platforms for students and inquisitive minds to showcase their technical skills and knowledge. The 13th edition of Pragyan, sponsored by MRF Pvt.… Read More »

Generators of finite cyclic group under addition

Given a number n, find all generators of cyclic additive group under modulo n. Generator of a set {0, 1, … n-1} is an element x such that x is smaller than n, and using x (and addition operation), we can generate all elements of the set. Examples: Input : 10 Output : 1 3… Read More »

Java.io.LineNumberReader 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 »

Java.util.zip.GZIPInputStream 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: http://www.spoj.com/problems/TSHOW1/ The idea is… Read More »