Topic — Add New » Posts Last Poster Freshness
Finding the Longest Increasing Sub-sequence in an Array 5 Venki 15 hours

[b]Write A program to find the longest Increasing Sub-sequence in an Array. In sub-sequence, elements may not be contiguous, but these should be in Increasing Order.[/b]
E.g.
arr[]={4,2,6,1,7,9,8}
The longest increasing sub-sequence is : 4,6,7,8 with the length 4 or 2,6,7,8 with the length 4 or 4,6,7,9 and 2,6,7,9.

/*Program-Finding the longest ascending subsequence in a given array
using Dynamic Programming
Complexity-O(N^2)*/
#include<iostream>
using namesp...
interview question 5 spandan 1 day

Suppose that in addition to being sorted, the entries of A are distinct integers. Design an efficient algorithm for finding an index i such that A[i]=i or indicating that no such index exists.

In my opinion, I think better approach should be iterative as the problem does not specifies that there is single occurrence of such type of element. And in case if we need to display to all occurrence of such elements, we need to traverse the full array to search all such occurrences. We can use...

Amazon Interview Question Password Checker 8 atul007 2 days

Given a string tell whether its a valid passwd or not.
Other rules are simple but the third one is tricky:
* the string should not have the same substring following each other
ex:
stringstring is incorrect
strin123strin is correct

Any suggestions on how to approach the above rule?

find all increasing subsequences 4 asm 2 days

given an array of integers, we need to find all strictly increasing subsequences in this array.
A subsequence can start at any element and end at any element.

Example: {5,1,6,8,7,15,2,45,3,6}
then possible subsequences are:
[1 2 45 ]
[1 6 7 15 45 ]
[5 6 7 15 45 ]
[1 6 8 15 45 ]
[5 6 8 15 45 ]
[1 2 3 6 ]
[5 6 ]

ps. I know there is a closely related problem where we need to find the *longest* increasing subsequence which can ...

Find majority Element using Divide and Conquer Algorithm 2 Venki 3 days

I want to use Divide and Conquer algorithm for finidng Majority Candidate from an Array.
Can any let me know how todo that ? Or Can any one give me a pseduo code ?

Thanks,
Shal

Amazon Banglore Online Written 6 asm 5 days

In given array of elements like [a1,a2,a3,..an,b1,b2,b3,..bn,c1,c2,c3,...cn] Write a program to merge them like [a1,b1,c1,a2,b2,c2,...an,bn,cn].

PS: Doing without using extra memory would fetch more points

Sample Testcases:

Input #00:

{1,2,3,4,5,6,7,8,9,10,11,12}

Output #00:

{1,5,9,2,6,10,3,7,11,4,8,12}

Explanation:

Here as you can notice, the array is of the form
{a1,a2,a3,a4,b1,b2,b3,b4,c1,c2,c3,c4}

numeric puzzle 4 asm 6 days

given 3 strings X, Y and Z. Find all solutions to a numeric puzzle: X + Y = Z where
each character in a string corresponds to some digit (note that, different characters
can map to the same digit).
You may assume that strings are of the same length

example: X = "abcd", Y = "dbcc", Z = "cdda"
then: 2275 + 5277 = 7552

Finding The Median 1 krishnan 1 week

How to find the median of an array of integers using Heaps

Nearest palindrome for a number 14 Guddu Sharma 1 week

Given a number u need to find a closest palindrome of a number..
Example..
For 7957, the nearest palindrome is 7997

Next higher palindrome 6 Guddu Sharma 1 week

Given a positive number what is the best algorithm to find the smallest number greater than the given number which is a palindrome.
For example it will be 11 for 10
2222 for 2133
101 for 100

Create PDF: LZWEncoding, ASIII85 compressing Question 1 jdcasazza 2 weeks

Trying to create PDF fill using LZW (Lempel-Ziv-Welch) & ASCII base-85 Compression but cannot under PDF Reference book on how to encode these. Text Reads below. I do not understand how to code this and am looking for any coding examples that can do this. Thanks! JIm C of Marietta, GA
--------------------------------------------------------------------------------------------
[b]Details of LZW Encoding[/b]

Data encoded using the LZW compression method consists of a seque...

Find whether elements of array add to given number. 3 art_monu 2 weeks

Suppose we have been given the maximum size of array. We enter positive integers as the array elements. And we are given a value n. We have to write code to print yes or no depending on whether the elements of the array can be chosen to sum to the given number n.

Implement Bounded Priority Queue 1 Venki 2 weeks

Implement bounded priority queue, "a queue that will contain maximum N elements". Implement the data structure using existing data structures (like as an adapter class on STL container classes).

Algorithms and Time Complexity 4 devsathish 2 weeks

If you have an array of n elements, how would you devise an O(n lg n) time algorithm for outputting a list of those elements that appear more than once in the original array.

Minimum Path cover 1 archit 2 weeks

Looking for a detail explanation of minimum path cover problem for directed acyclic graph

A Dynamic Programming question 1 jakati 3 weeks

You have been appointed as the gift czar for Giggle, Inc.’s annual mandatory holiday party! The president of the company, who is certifiably insane, has declared that every Giggle employee must receive one of three gifts: (1) an all-expenses-paid six-week vacation anywhere in the world, (2) an all-the-pancakes-you-can-eat breakfast for two at Jumping Jack Flash’s Flapjack Stack Shack, or (3) a burning paper bag full of dog poop. Corporate regulations prohibit any employee from receiving t...

[closed] Algorithms and Time Complexity 2 kartik 3 weeks

If you have an [b]array of n elements, how would you devise an O(n lg n) time algorithm for [/b]outputting a list of those elements that appear more than once in the original array.