Featured Article

Python List Comprehension and Slicing

List comprehension is an elegant way to define and create list in python. We can create lists just like mathematical statements and in one line only. The syntax of list comprehension is easier to grasp. A list comprehension generally consist of these parts : Output expression, input sequence, a variable representing member of input sequence… Read More »

Featured Article

Lambda expression in C++

C++ 11 introduced lambda expression to allow us write an inline function which can be used for short snippets of code that are not going to be reuse and not worth naming. In its simplest form lambda expression can be defined as follows: [ capture clause ] (parameters) -> return-type { definition of method }… Read More »

Featured Article

Returning Multiple Values in Python

In Python, we can return multiple values from a function. Following are different ways 1) Using Object: This is similar to C/C++ and Java, we can create a class (in C, struct) to hold multiple values and return an object of the class. Output: geeksforgeeks 20 Below are interesting methods for somebody shifting C++/Java world.… Read More »

Featured Article

HashMap and TreeMap in Java

HashMap and TreeMap are part of collection framework. HashMap java.util.HashMap class is a Hashing based implementation. In HashMap, we have a key and a value pair<Key, Value>. HashMap<K, V> hmap = new HashMap<K, V>(); Let us consider below example where we have to count occurrences of each integer in given array of integers. Input: arr[]… Read More »

Scanner Class in Java

Scanner is a class in java.util package used for obtaining the input of the primitive types like int, double etc. and strings. It is the easiest way to read input in a Java program, though not very efficient if you want an input method for scenarios where time is a constraint like in competitive programming.… Read More »

Permutation Coefficient

Permutation refers to the process of arranging all the members of a given set to form a sequence. The number of permutations on a set of n elements is given by n! , where “!” represents factorial. The Permutation Coefficient represented by P(n, k) is used to represent the number of ways to obtain an… Read More »

When to use yield instead of return in Python?

The yield statement suspends function’s execution and sends a value back to caller, but retains enough state to enable function to resume where it is left off. When resumed, the function continues execution immediately after the last yield run. This allows its code to produce a series of values over time, rather them computing them… Read More »

G-Fact 41 (Setting decimal precision in C)

How to print floating point numbers with a specified precision? Rounding is not required. For example, 5.48958123 should be printed as 5.4895 if given precision is 4. For example, below program sets the precision for 4 digits after the decimal point: Output: 5.489500 We can generalize above method using pow() In C, there is a… Read More »

Microsoft Interview Experience | Set 87 (On-Campus)

15 MCQs on c/c++ output based, 1 java questions was also there. Coding Round: 1. Convert a binary tree to its sum tree (http://www.geeksforgeeks.org/convert-a-given-tree-to-sum-tree/). 2. Count number of binary strings without consecutive 1’s. (http://www.geeksforgeeks.org/count-number-binary-strings-without-consecutive-1s/). Group fly round (for MSIDC): 1. Sort a string according to the order given by another string. Group Fly round (for… Read More »

Alcatel Lucent (Nokia) Interview Experience | Set 2 (On-Campus for Testing and Software Development)

Round1: aptitude            Quant            Verbal            Computer programming            Logical reasoning Difficulty: easy            Coding Two questions            1) arrange first half array in increasing and then other in decreasing order.            2) finding generalized HCF of a array. Round 2: Technical Interview            OS questions were basic like how to create a process,… Read More »

Oracle Interview Experience | Set 22 (On-Campus for Oracle Financial Services Software)

Written round: There were questions related to quantitative,logical and verbal.(Not of very high level,but speed should be good enough). Technical PI: 1. C:Basic topics of C.Malloc and Clloc difference.Storage classes.Let us C is enough . 2. C++/Java: OOPs concept with real life examples,Collection in Java,Constructors etc . Site i referred: JAVATPOINT 3. DBMS: Explain normalization… Read More »