## Longest positive subarray

Array A[] contains only ‘1’ and ‘-1’

Construct array B, where B[i] is the length of the longest continuous subsequence starting at j and ending at i, where j < i and A[j] + .. + A[i] > 0

…

Technical knowledge for tech readers and developers

algorithm

Array A[] contains only ‘1’ and ‘-1’

Construct array B, where B[i] is the length of the longest continuous subsequence starting at j and ending at i, where j < i and A[j] + .. + A[i] > 0

…

I was asked this during a Google Interview.

We are given a string consisting of letters- F,L,R. – which is the instruction a robot follows

F- goes forward by one step.

L-turn left.

R- turn right.

…

I’m trying to solve a problem related to graphs in Python. Since its a comeptitive programming problem, I’m not using any other 3rd party packages.

The problem presents a graph in the form of a 5 X …

Possible Duplicates:

Calculating large factorials in C++

Howto compute the factorial of x

How do you implement the factorial function in C++? And by this I mean properly implement it using …

Today there was a question on SO, where the author was given an NP-complete problem during an interview and he obviously hadn’t been told that it was one.

What is the purpose of asking such questions?…

I’m reading the book Algorithms in a Nutshell published by O’Reilly Media and I was reading the section on sorting algorithms and found one called Median Sort. Since I had never heard of it before and …

I had this question in interview which I couldn’t answer.

You have to find first unique element(integer) in the array.

For example:

3,2,1,4,4,5,6,6,7,3,2,3

Then unique elements are 1, 5, 7 and first …

I grabbed a database of the zip codes and their langitudes/latitudes, etc from this

This page. It has got the following fields:

ZIP, LATITUDE, LONGITUDE, CITY, STATE, COUNTY, ZIP_CLASS

The data …

I’m having a bit of a mind blank on this at the moment.

I’ve got a problem where I need to calculate the position of points around a central point, assuming they’re all equidistant from the center and …

How to compute the integer absolute value without using if condition.

I guess we need to use some bitwise operation.

Can anybody help?