Featured Article

## Maximum sum of i*arr[i] among all rotations of a given arrayJuly 27, 2016

Given an array arr[] of n integers, find the maximum that maximizes sum of value of i*arr[i] where i varies from 0 to n-1. Examples: Input : arr[] = {8, 3, 1, 2} Output : 29 Explanation : Let us see all rotations {8, 3, 1, 2} = 8*0 + 3*1 + 1*2 + 2*3… Read More »

Featured Article

## Minimax Algorithm in Game Theory | Set 4 (Alpha-Beta Pruning)July 24, 2016

Prerequisites: Minimax Algorithm in Game Theory, Evaluation Function in Game Theory Alpha-Beta pruning is not actually a new algorithm, rather an optimization technique for minimax algorithm. It reduces the computation time by a huge factor. This allows us to search much faster and even go into deeper levels in the game tree. It cuts off… Read More »

Featured Article

## Two Dimensional Binary Indexed Tree or Fenwick TreeJuly 16, 2016

Prerequisite – Fenwick Tree We know that to answer range sum queries on a 1-D array efficiently, binary indexed tree (or Fenwick Tree) is the best choice (even better than segment tree due to less memory requirements and a little faster than segment tree). Can we answer sub-matrix sum queries efficiently using Binary Indexed Tree… Read More »

## Print Maximum Length Chain of PairsJuly 31, 2016

You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. A pair (c, d) can follow another pair (a, b) if b < c. Chain of pairs can be formed in this fashion. Find the longest chain which can be formed from a given set… Read More »

## Print all n-digit numbers with absolute difference between sum of even and odd digits is 1

Given number of digits n, print all n-digit numbers whose absolute difference between sum of digits at even and odd positions is 1. Solution should not consider leading 0’s as digits. Examples: Input: n = 2 Output: 10 12 21 23 32 34 43 45 54 56 65 67 76 78 87 89 98 Input:… Read More »

## Print all n-digit numbers whose sum of digits equals to given sum

Given number of digits n, print all n-digit numbers whose sum of digits adds upto given sum. Solution should not consider leading 0’s as digits. Examples: Input: N = 2, Sum = 3 Output: 12 21 30 Input: N = 3, Sum = 6 Output: 105 114 123 132 141 150 204 213 222 231… Read More »

## Oracle Interview Experience | Set 24 (On-Campus for Global Business Unit)July 30, 2016

Round 1 : multiple choice questions based on Aptitude: Work and time problems, speed and distance problems, permutations and combinations, age related, relations (father-son), etc Note. U should be really fast at it since u would have not more than a minute for each question Verbal: this was not that tough to crack. If you… Read More »

## Amazon Interview Experience | Set 278 (On-Campus)

Recently Amazon visited our campus for recruitment process. They conducted several rounds based on the interviewee’s capacity. Round 1: 90 minutes 20 MCQs and 2 Programming Questions. Programs were based on Strings and Arrays. The modules were already given by the company itself. The first was conducted in HackerRank. Round 2: 75 minutes. Pen and… Read More »

## D E Shaw Interview Experience | Set 18 (On-Campus)

ROUND 1: About 250 students having (8 or 8.5 cgpa) cutoff were shortlisted for an online test in Hackerrank. It consisted of 3 sections- Section 1: One programming question, which was quite simple, many test cases were based on end cases. (20 minutes) Section 2: General aptitude, 10 questions which was difficult for most of… Read More »

## Amazon Interview Experience | Set 277 (On-Campus for Internship)

Recently Amazon visited our campus for interns and placements. For interns it consisted of 1 online + 2 technical rounds. Online:(90 mins) 20 MCQ’S based mainly on sorting, OS,Networks 2 coding questions: 1. Given a number find the next greatest number formed with same digits http://www.geeksforgeeks.org/find-next-greater-number-set-digits/ 2. Find the largest increasing sequence in an array… Read More »

## MakeMyTrip Interview Experience | Set 12July 29, 2016

I’d like to share my MakeMyTrip interview experience with GeeksforGeeks. I interviewed with MakeMyTrip in Bangalore in the month of July, 2016. Round 1 Given an array of sorted integers, with many of them repeating, and an element x, find the number of occurrences of x. Expected time complexity O(lgn) You have a certain amount… Read More »

## BankBazaar.com Interview Experience | Set 5

Round 1: Online Coding Test There are n ticket sellers, each of whom has a certain amount of tickets. The price of each ticket is the number of tickets that ticket-seller has. The number of tickets they want to sell is k. Find the maximum amount that they can earn by selling k tickets. (The… Read More »

## Geek on the Top – Sumeet Varma | Actual fun begins when you solely concentrate on finding algo to solve a problem

Geek on the top is all about success stories of Geeks who are working hard to chase their goals and are inspiration for other geeks. Our first Geek is the coding champ – Sumeet Varma who is extremely talented and leaving no stones unturned to make India proud on international platforms. Sumeet Varma is persuing… Read More »

## Mathematical Functions in Python | Set 4 (Special Functions and Constants)

Some of the mathematical functions are discussed in below set 1, set 2 and set 3 Mathematical Functions in Python | Set 1 (Numeric Functions) Mathematical Functions in Python | Set 2 (Logarithmic and Power Functions) Mathematical Functions in Python | Set 3 (Trigonometric and Angular Functions) Special Functions and constants are discussed in this… Read More »

## Default Methods In Java

Before Java 8, interfaces could have only abstract methods. The implementation of these methods has to be provided in a separate class. So, if a new method is to be added in an interface then its implementation code has to be provided in the class implementing the same interface. To overcome this issue, Java 8… Read More »

## Print all n-digit strictly increasing numbers

Given number of digits n in a number, print all n-digit numbers whose digits are strictly increasing from left to right. Examples: Input: n = 2 Output: 01 02 03 04 05 06 07 08 09 12 13 14 15 16 17 18 19 23 24 25 26 27 28 29 34 35 36 37… Read More »

## Add elements of given arrays with given constraints

Given two integer arrays, add their elements into third array by satisfying following constraints – 1. Addition should be done starting from 0th index of both arrays. 2. Split the sum if it is a not a single digit number and store the digits in adjacent locations in output array. 3. Output array should accommodate… Read More »

## Amazon Interview Experience | Set 276 ( On-Campus SDE-I)July 28, 2016

Round 1(Online test : MCQ+Coding) 18 basic MCQ from OS, C, Shell, DBMS(SQL, NoSQL), puzzle(25 horses, find fastest three) :attempted 12/13 2 Coding questions: Given a string and a pattern state whether it follows the pattern. For eg: s = “redblueredgreen” matches pattern “abac” but not “aaab” as ‘red’ means ‘a’, ‘blue’ means ‘b’ and… Read More »

## Directi Interview | Set 11 (On-Campus)

Directi came to my college for Operations Engineer (DevOps ) profile. There was a presentation and PPT(pre-placement talk) through which we got a chance to interact with them and got know more about Directi initiatives. Interview Process: MCQ (DOT Test) Coding Round (Offline with Documentation) Face to Face (Technical Interview) Face to Face (Technical Interview)… Read More »

## Largest product of a subarray of size k

Given an array consisting of n positive integers, and an integer k. Find the largest product subarray of size k, i.e., find maximum produce of k contiguous elements in the array where k

## Mathematical Functions in Python | Set 3 (Trigonometric and Angular Functions)

Some of the mathematical functions are discussed in below set 1 and set 2 Mathematical Functions in Python | Set 1 (Numeric Functions) Mathematical Functions in Python | Set 2 (Logarithmic and Power Functions) Trigonometric and angular functions are discussed in this article. 1. sin() :- This function returns the sine of value passed as… Read More »

## Find Jobs involved in Weighted Job SchedulingJuly 27, 2016

Given N jobs where every job is represented by following three elements of it. 1. Start Time 2. Finish Time 3. Profit or Value Associated Find the subset of jobs associated with maximum profit such that no two jobs in the subset overlap. Examples: Input: Number of Jobs n = 4 Job Details {Start Time,… Read More »

## Treebo (Ruptub Solutions Pvt Ltd) Interview Experience | Set 1

WRITTEN ROUND – 1) Variation of Array Partitioning (Solved using DP) 2) OZ graph , Graph related ques solved using BFS ROUND 1- 1) Replace each element in an array with multiplication of all others except that , division operator is not allowed. 2) You are given an infinite array you need to find minimum… Read More »