## Nitin Gupta

BAN USER- 1of 1 vote

AnswersGiven an array of integers and a number. WAP to find the pairs which sum of upto given number.

- Nitin Gupta in India for Cloud & Enterprise team

I solved it. Then he asked about writing test cases for this function.

I wrote below test cases

1.) All the elements should be number.

2.) Length of array should not be 0.

3.) Array itself should not be null.

4.) Given number, arrayLength can be represented by 32bits or 64 bits.

5.) number should not be negative.

6.) Input does not has pair, It should return false

7.) Input has pair, It should return true

8.) Input has all negative values and pair exists, then function should return true

9.) Input has all negative values and pair does not exists, function should return false

He told that he is looking for more test cases. Can you guys think of some more complex test cases.| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm Arrays C++ Data Structures - 0of 0 votes

AnswersIn a Formula-1 challenge, there are n teams numbered 1 to n. Each team has a car and a driver. Car’s specification are as follows:

- Nitin Gupta in India

– Top speed: (150 + 10 * i) km per hour

– Acceleration: (2 * i) meter per second square.

– Handling factor (hf) = 0.8

– Nitro : Increases the speed to double or top speed, whichever is less. Can be used only once.

Here i is the team number.

The cars line up for the race. The start line for (i + 1)th car is 200 * i meters behind the ith car.

All of them start at the same time and try to attain their top speed. A re-assessment of the positions is done every 2 seconds(So even if the car has crossed the finish line in between, you’ll get to know after 2 seconds). During this assessment, each driver checks if there is any car within 10 meters of his car, his speed reduces to: hf * (speed at that moment). Also, if the driver notices that he is the last one on the race, he uses ‘nitro’.

Taking the number of teams and length of track as the input, Calculate the final speeds and the corresponding completion times.| Report Duplicate | Flag | PURGE

Google SDE1 Algorithm Arrays Data Structures Java Object Oriented Design - 0of 0 votes

AnswersUpdate to careercup android app

- Nitin Gupta in India

I gave one update to careercup app.

Now you can get the right questions which you want to focus on.

https://play.google.com/store/apps/details?id=com.careercup

Install it from here to know more.

P.S. - It is free and available throughout the world. Also write reviews, feature requests, and give ratings

Thanks Guys| Report Duplicate | Flag | PURGE

- 1of 3 votes

AnswersNew CareerCup Android App!!!

- Nitin Gupta in United States

Hey Guys,

Lately I was trying to get android app for this website and no single app was good enough for me.

So I thought of developing it myself. After 2 weekends of work I released first version of the app. With lot more new features lined up.

Please download it here

https://play.google.com/store/apps/details?id=com.careercup

and give your reviews and ratings.

Thanks| Report Duplicate | Flag | PURGE

A9 SDE1 - 0of 0 votes

AnswersWrite printf method.

- Nitin Gupta in India| Report Duplicate | Flag | PURGE

Amazon SDE1 Algorithm - 1of 1 vote

AnswersWhich is best Merge Sort or QuickSort?

- Nitin Gupta in India

Why and How?| Report Duplicate | Flag | PURGE

Amazon SDE1 Algorithm - -5of 7 votes

AnswersGiven a matrix of size M X N containing all 0's, and a co-ordinate (i, j) in the matrix.

You have to fill the matrix with L shape block (made by 3 blocks, each block is having 1) except the given co-ordinate.`1 1 1 1 1 1 1 1 1 1 1 1`

Note - L shaped block can be rotated, so finally there will be 4 orientation for L shape block.

- Nitin Gupta in United States for AppStore

You can assume that solution always exists.

Later on he changed matrix to N X N where N = 2^n.| Report Duplicate | Flag | PURGE

Amazon SDE1 Algorithm - 1of 9 votes

AnswersGiven one egg and a building with infinite number of floors. Find out minimum number of throws at which (least) floor egg will break, if thrown?

- Nitin Gupta in India for Illustrator

I said we have to start at floor 1 and keep incrementing and testing by moving 1 floor up. Then he said optimize it by minimizing no of throws. I could not find more optimal way. I told him that I know with problem with 2 eggs and finite floor building.

Then, he told me that now lets there are 2 eggs and infinite floor building, find minimum no if throws required to find least floor at which egg breaks.

I still could not do that for infinite floors.| Report Duplicate | Flag | PURGE

Adobe Member Technical Staff Brain Teasers - -2of 2 votes

AnswersGiven 2 arrays with numbers, multiply the numbers with corresponding indexes and return the sum of all the products.

- Nitin Gupta in India for WebStore

Twist :- When one array gets consumed then start with its first element again.

A : 1,2,3,4,5

B : 2,1

Output: 24 (1*2 + 2*1 + 3*2 + 4*1 + 5*2)| Report Duplicate | Flag | PURGE

Amazon SDE1 Algorithm - -1of 3 votes

AnswersPrint N numbers of form 2^i.5^j in increasing order for all i >= 0 , j >= 0 ?

- Nitin Gupta in India for WebStore

Example : - 1,2,4,5,8,10,16,20.....| Report Duplicate | Flag | PURGE

Amazon SDE1 Algorithm - 1of 5 votes

AnswersBelow question was asked in online coding exam for Palantir Technology, Palo Alto, CA. Time given was 100 min. I could not complete it by the time.

- Nitin Gupta in United States

-----------------------------

A group of farmers has some elevation data, and we’re going to help them understand how rainfall flows over their farmland.

We’ll represent the land as a two-dimensional array of altitudes and use the following model, based on the idea that water flows downhill:

If a cell’s four neighboring cells all have higher altitudes, we call this cell a sink; water collects in sinks.

Otherwise, water will flow to the neighboring cell with the lowest altitude. If a cell is not a sink, you may assume it has a unique lowest neighbor and that this neighbor will be lower than the cell.

Cells that drain into the same sink – directly or indirectly – are said to be part of the same basin.

Your challenge is to partition the map into basins. In particular, given a map of elevations, your code should partition the map into basins and output the sizes of the basins, in descending order.

Assume the elevation maps are square. Input will begin with a line with one integer, S, the height (and width) of the map. The next S lines will each contain a row of the map, each with S integers – the elevations of the S cells in the row. Some farmers have small land plots such as the examples below, while some have larger plots. However, in no case will a farmer have a plot of land larger than S = 5000.

Your code should output a space-separated list of the basin sizes, in descending order. (Trailing spaces are ignored.)

While correctness and performance are the most important parts of this problem, a human will be reading your solution, so please make an effort to submit clean, readable code. In particular, do not write code as if you were solving a problem for a competition.

A few examples are below.

Input:

3

1 5 2

2 4 7

3 6 9

Output:

7 2

The basins, labeled with A’s and B’s, are:

A A B

A A B

A A A

Input:

1

10

Output:

1

There is only one basin in this case.

Input:

5

1 0 2 5 8

2 3 4 7 9

3 5 7 8 9

1 2 5 4 2

3 3 5 2 1

Output:

11 7 7

The basins, labeled with A’s, B’s, and C’s, are:

A A A A A

A A A A A

B B A C C

B B B C C

B B C C C

Input:

4

0 2 1 3

2 1 0 4

3 3 3 3

5 5 2 1

Output:

7 5 4

The basins, labeled with A’s, B’s, and C’s, are:

A A B B

A B B B

A B B C

A C C C| Report Duplicate | Flag | PURGE

Palantir Technology Front-end Software Engineer Algorithm - -1of 3 votes

AnswersGiven a number x = 0x25. Convert it into y = 0x25252525.

- Nitin Gupta in India| Report Duplicate | Flag | PURGE

Adobe Member Technical Staff Algorithm Bit Manipulation C Coding - -1of 1 vote

AnswersWe have a long chain of cuboids in all the six directions (six faces). One start node is given and one end node is given. Give a data structure to represent this also search for the given node from start node.

- Nitin Gupta in India for Live Cycle| Report Duplicate | Flag | PURGE

Adobe Member Technical Staff Algorithm Data Structures - -1of 1 vote

AnswersGiven a number, find next higher palindrome number that comes after this number. Give algorithm.

- Nitin Gupta in United States for Live Cycle| Report Duplicate | Flag | PURGE

Adobe Member Technical Staff Algorithm - -1of 1 vote

AnswersWrite a code to generate Pascals triangle of any level.

- Nitin Gupta in India| Report Duplicate | Flag | PURGE

Adobe MTS Algorithm Data Structures - 0of 2 votes

AnswersI have a list of N teams T1, T2, T3 … Tn. Each of these teams has played a match against every other team. I have a function displayResult(Team T1, Team T2), it returns the team which won the match between any two given teams T1 and T2.

- Nitin Gupta in India

I have to write the teams in an order such the (n-1)th team (in the order) had lost to the nth team which in turn had lost to (n+1)th team..Write Code| Report Duplicate | Flag | PURGE

Adobe MTS SDE1 Algorithm Data Structures - -1of 1 vote

AnswersGiven a sorted but rotated array. Find the pivot.

- Nitin Gupta in India| Report Duplicate | Flag | PURGE

Adobe MTS Algorithm Arrays Data Structures - 0of 0 votes

AnswersAlice is a kindergarden teacher. She wants to give some candies to the children in her class. All the children sit in a line and each of them has a rating score according to his or her usual performance. Alice wants to give at least 1 candy for each child.Children get jealous of their immediate neighbors, so if two children sit next to each other then the one with the higher rating must get more candies. Alice wants to save money, so she wants to minimize the total number of candies.

- Nitin Gupta in India| Report Duplicate | Flag | PURGE

Algorithm Data Structures - 3of 3 votes

AnswersQ1.- Written exam (Amazon, Bangalore)

- Nitin Gupta in India

Given a singly link list and a number 'K', swap the Kth node from the start with the Kth node from the last. Check all the edge cases.

Sample Input: 1->2->3->4->5->6->7->8 and K = 3

Sample Output : 1->2->6->4->5->3->7->8

Sample Input: 1->2->3->4->5->6->7->8 and K = 10

Sample Output: print error "LIST IS OF LESSER SIZE".| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Algorithm C C# C++ Coding Data Structures Java Linked Lists - 0of 0 votes

AnswersQ2. F2F Round-1, Amazon(Bangalore)

- Nitin Gupta in India

Given an array of integers having the property that first that array is strictly increasing then it is strictly decreasing, You have to search for a given number.

Constraint: Minimize the complexity| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Algorithm Arrays C C# C++ Coding Data Structures Java - 0of 0 votes

AnswersQ1. F2F Round 1 Amazon(Bangalore)

- Nitin Gupta in India

Given a character array as input. Array contains only three types of characters 'R', 'G' and 'B'. Sort the array such that all 'R's comes before 'G's and all 'G's comes before 'B's.

Constraint :- No extra space allowed(except O(1) space like variables) and minimize the time complexity.

You can only traverse the array once.| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Algorithm Arrays C C# C++ Coding Data Structures Java Sorting - 0of 0 votes

AnswersQ4. Written Exam Amazon(Bangalore)

- Nitin Gupta in India

Given an array of integers A[1....n-1] where 'N' is the length of array A[ ]. Construct an array B such that B[i] = min(A[i], A[i+1], ......., A[i-K+1]), where K will be given.

Array B will have N-K+1 elements.

Constraint: Extra space allowed O(K) and time complexity allowed O(N.K) or lower.| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Algorithm Arrays C C# C++ Coding Data Structures Java Sorting - 1of 1 vote

AnswersQ3. Written Exam Amazon(Bangalore)

- Nitin Gupta in India

Given a singly linked list which may or may not contain loop and loop may or may not start from the head node. Count the number of elements in the linked list.| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Algorithm C C# C++ Coding Data Structures Java Linked Lists - 0of 0 votes

AnswersQ2. Written Exam Amazon(Bangalore)

- Nitin Gupta in India

Given a number in the form of string. Output the binary equivalent of that number.

Sample Input: "8.5"

Sample Output: 1000.1

Sample Input: "12.34.23"

Sample Output: "ERROR"| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Algorithm C C# C++ Coding Java Math & Computation - 0of 0 votes

AnswersQ2. F2F Round-1, Amazon(Bangalore)

- Nitin Gupta in India

Given an array of integers having the property that first that array is strictly increasing then it is strictly decreasing, You have to search for a given number.

Constraint: Minimize the complexity| Report Duplicate | Flag | PURGE

Algorithm - 0of 0 votes

AnswerQ1. F2F Round 1 Amazon(Bangalore)

- Nitin Gupta in India

Given a character array as input. Array contains only three types of characters 'R', 'G' and 'B'. Sort the array such that all 'R's comes before 'G's and all 'G's comes before 'B's.

Constraint :- No extra space allowed(except O(1) space like variables) and minimize the time complexity.

You can only traverse the array once.| Report Duplicate | Flag | PURGE

Algorithm - 0of 0 votes

AnswersQ4. Written Exam Amazon(Bangalore)

- Nitin Gupta in India

Given an array of integers A[1....n-1] where 'N' is the length of array A[ ]. Construct an array B such that B[i] = min(A[i], A[i+1], ......., A[i-K+1]), where K will be given.

Array B will have N-K+1 elements.

Constraint: Extra space allowed O(K) and time complexity allowed O(N.K) or lower.| Report Duplicate | Flag | PURGE

Algorithm - 0of 0 votes

AnswersQ1.- Written exam (Amazon, Bangalore)

- Nitin Gupta in India

Given a singly link list and a number 'K', swap the Kth node from the start with the Kth node from the last. Check all the edge cases.

Sample Input: 1->2->3->4->5->6->7->8 and K = 3

Sample Output : 1->2->6->4->5->3->7->8

Sample Input: 1->2->3->4->5->6->7->8 and K = 10

Sample Output: print error "LIST IS OF LESSER SIZE".| Report Duplicate | Flag | PURGE

Algorithm

- 4 Answers
**Adobe Software Engineer Profile for White Box Testing**Hi All,

- Nitin Gupta May 15, 2012

I want to know that how good is this profile for Software Engineer. Currently I am working in Samsung, Bangalore as Software Engineer. I want to grow as Software Developer in some very good company like Amazon, Google, Microsoft, Adobe etc.

Though the company is Adobe and profile is Software Engineer but it is creating doubt in my mind as they have written White Box testing in the mail. Please find the below mail as received by me from Adobe. Kindly enlighten me keeping my career prospect in mind. Should I take it or not??

------------------------------------------------------------

Mail From Adobe

------------------------------------------------------------

For white box testers for our Product Adobe Flash Professionals. The profile requires coding, scripting and automation experience. The candidate will be designated as Software Engineer and will be responsible for testing of Adobe products. We're looking for an individual with excellent programming and communication skills.

Requirements:

1. Hands on C++ programming.

2. Should have expertise in scripting - JavaScript and/or Action Script. Experience in Flex/Flash technologies will be preferred.

3. Strong Windows and OS fundamentals. Mac OS experience will be an added advantage.

4. Exposure in writing full test frameworks would be a definite advantage

5. Should have excellent bug writing skills often suggesting the technical solutions to the issues.

6. People with experience in Automation tools like Silk Test will be preferred.

7. This person should be capable of working independently and collaboratively with a team.

8. B.E/B.Tech/M tech/MCA with 0 to 4 years' experience in testing Desktop and Enterprise/Cloud Products.

9. Excellent verbal and written communication skills.

Any help will be appreciated.

Thanks| Flag | PURGE

Input

The first line of the input is an integer N, the number of children in Alice's class. Each of the following N lines contains an integer indicates the rating of each child.

Ouput

Output a single line containing the minimum number of candies Alice must give.

Sample Input

3

1

2

2

Sample Ouput

4

Explanation

The number of candies Alice must give are 1, 2 and 1.

Constraints:

N and the rating of each child are no larger than 10^5.

2 times.

- Nitin Gupta August 14, 2012Is it a free service or there is any fee for that ?

- Nitin Gupta August 08, 2012In which organization there job opportunities ?

- Nitin Gupta August 08, 2012You can use StringBuffer in place of String as String Buffer is mutable.

- Nitin Gupta July 10, 2012@eugene : its two weeks long contest...see the link Amazon India Programmuing Contest

www[dot]interviewstreet[dot]com

Amazon India Programming contest on InterviewStreet[dot]com

- Nitin Gupta June 26, 2012What is the logic for getting this formula 2n(1+3z) ?

Please always explain fully the logic you are following and then write code...just writing code does not helps the cause.

Only the base of log will change according to the number of partitions created.

2 partitions - Base of log will be 2

3 partitions - Base of log will be 3

4 partitions - Base of log will be 4

So on

Thanks debugger,

Do u work for Adobe ? R u based in India ? Though I have made up my mind, so I am not going to give interview for above profile as it will affect my career growth in development domain. Also because Adobe has policy that candidate can't appear again till 1 year. So I thought not to give this interview as in future there might be openings for development domain. Then I can apply.

:)

First of all thanks a lot Gayle for such a quick response.

Though I have applied and my interview is scheduled this Saturday, I want to know that can I switch to the actual SE profile in other companies. How exactly the work differs in this case as compared to SE profile.

My next question is : Do these companies gives profile of SE/SDE is a person is SET/SDET ?

Step 3 : Traverse to the N-K+1 th element from the beginning to get the kth element from last

- Nitin Gupta May 12, 2012Whenever nothing is referring to object, then automatic garbage collector is called to finish off the mess.

- Nitin Gupta May 12, 2012nitingupta180@gmail.com

- Nitin Gupta May 11, 2012

RepSpent high school summers donating toy monkeys in Minneapolis, MN. At the moment I'm building glue in Edison, NJ ...

RepDiscover the cheapest packers and movers in Gurgaon at best price with smooth and hassle free relocation. We provide truck ...

Rep**nyladsomerville**, abcWant to purchase best quality silencer at affordable price manufactured by top most trusted brand Innovative Arms.

Contact Stonefirearms now!

Rep**Jerryesumrall777**, Consultant at NoneHello Everyone, My name is Jerrye Sumrall and I am 34 years of age and I originate from Ocean city ...

Rep**Lynnebailey3333**, Systems Design Engineer at NoneHello Everyone, My name is Lynne Bailey from Phoenix, AZ I am an expert visual originator. I am working this ...

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

Amit - Question clearly says that student with higher rating should get more candies. Nothing about equal rating. So in case of equal rating we can give less candies.

- Nitin Gupta August 15, 2012