Anda di halaman 1dari 25

1.

while(lock); lock = 1; //Critical section lock = 0;

say process 1 set lock variable to 1 and gets pre-empted .. process2 executes the same code and comes to critical section and gets pre-empted.. now process1 resumed.. NOW BOTH ARE IN CRITICAL SECTION .

2. N=(N&( (~0<<j) | (~(1<<i))) | (M<<i)

int temp = {[1<<(j-+1)]<<i-1}; Here temp is a number with all the bits set between positions i & j [both inclusive] temp = ~temp; N = N & temp; // here we are clearing all the bits of N from position i to j temp = temp | M; // now we are taking the bit pattern from M into temp in the given positions N = N | temp; // now again we are setting the same pattern from temp into N. Note :- clearing bit means bit set to zero , while setting bit means bit is 1

This is a question from Laakman. This code operates by clearing all bits in N between position i and j, and then ORing to put M in there 1 public static int updateBits(int n, int m, int i, int j) { 2 int max = ~0; /* All 1's */ 3 4 // 1's through position j, then 0's 5 int left = max - ((1 << j) - 1); 6 7 // 1's after position i 8 int right = ((1 << i) - 1); 9 10 // 1's, with 0s between i and j 11 int mask = left | right; 12 13 // Clear i through j, then put m in there 14 return (n & mask) | (m << i); 15 }

3.
How will u implement an abstract class in c++ w/o using pure virtual function???

will making all the constructors and assignment operators protected suffice....??? i doubt since the derived classes will be able to create objects of that class....and according to definition of abstract class, no object of it should be created...

2 malloc(): int **a=(int **)malloc(sizeof(int *)*nrows); for(i=0;i<nrows;i++) a[i]=(int *)malloc(sizeof(int)*ncols);

using only 1 malloc:

int **a=(int **)malloc(sizeof(int *)*nrows+(nrows*ncols)*(sizeof(int))); for(i=0;i<nrows;i++) { a[i]=(int*)(a+nrows+i*ncols); }

int *data; int **arr; data = malloc(sizeof(int) * nrows * ncols ); arr = malloc(sizeof(int*) * nrows);

for ( int i = 0; i < nrows; i++) { arr[i] = &data[ i * ncols ]; } 5.

You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e.g., M becomes a substring of N located at i and starting at j). EXAMPLE: Input: N = 10000000000, M = 10101, i = 2, j = 6 Output: N = 10001010100 _ #include<stdio.h> #include<stdlib.h> int main() {

int N,M,i,j; printf("Enter value scanf("%d",&N); fflush(stdin); printf("Enter value scanf("%d",&M); fflush(stdin); printf("Enter value scanf("%d",&i); fflush(stdin); printf("Enter value scanf("%d",&j); fflush(stdin); int a=0,k; for( k=0;k<j;k++) { a= a<<1; a=a|1; } for(k =0;k<i;k++) { a=a<<1; }

of N \n"); of M \n");

of i \n");

of j \n");

N = N &(~a); printf("value of N is %d",N); for(k=0;k<i;k++) M=M<<1; N=N|M; printf("value of N is %d",N); getchar(); } isnt it give us wrong mask???? say i=2; j=6; it gives mask as(i.e ~a) 1111111100000011 but i think from 2 to 6 5 0's are needed????plz tell the above prog is ok???or not???check by giving any input whose 7thy bit is set...thnx in advance

1. Java uses stack for byte code in JVM - each instruction is of one byte, so how many such instructions are possible in an operating system. 2. Three processes p1, p2, p3, p4 - each have sizes 1GB, 1.2GB, 2GB, 1GB. And each processes is executed as a time sharing fashion. Will they be executed on an operating system. 3. write a recursive program for reversing the linked list. 4. write a program for checking the given number is a palindrome. ( dont use string / array for converting number ). 5. write a recursive program for multiplying two numbers a and b, with

additions. The program should take care of doing min # additions as that of which ever number is lower between a and b. 6. There are two sets A and B with n integers, write a program to check the whether there exists two numbers a in A and b in B such that a+b = val ( val is given ); 7. write a program to return the row number which has max no of one's in an array of NxN matrix where all 1's occur before any 0's starts. 8. For every number that has 3 in its units place has one multiple which has all one's i.e. 111 is such multiple and 13 has a multiple 111111. Write a program to find such multiple for any number that has 3 at its units place. 9. what are the maximum no of edges that can be connected in a graph of n vertices and 0 edges such that after adding edges given graph is still disconnected. 10. One Question on critical section. For Analytical Test - Prepare the Questions in the barrons book of sample paper - 2 ( they have give two passages )

@Bharat: Simulate long division, dividing a number 1111...1 by the number. You can do this one digit at a time, printing the quotient digit by digit until you "bring down" a zero. It could look something like this: int n=<the number that ends with 3>; int divisor=1; while( divisor < n ) divisor = 10 * divisor + 1; while( divisor != 0 ) { printf("%d",divisor / n); divisor = 10 * (divisor % n) + 1; } printf("\n");

@Navin: No problem. Just print a 1 instead of a quotient digit. That makes the code even simpler, like this: int n=<the number that ends with 3>; int divisor=1; printf("1"); while( divisor != 0 ) { printf("1"); divisor = 10 * (divisor % n) + 1; } printf("\n");

I thought about it some more, and realize that my code wasn't correct. Try this: int n = <the number that ends with 3>; // e.g., int n = 13; int d = 1; while( d % n != 0 ) { printf("1"); d = 10 * (d % n) + 1; } printf("1\n");

7.
DETERMINE THE OUTPUT R1,R2,R3 ARE THREE REGISTERS START :POP R1 POP R2 COMPARE R2,0 JUMP_EQ DONE_Z PUSH R2 PUSH R1 SUBTRATCT R2,1 PUSH R2 CALL START POP R3 POP R1 POP R2 MULTIPLY R3,R2 JUMP DONE DONE_Z:MOVE R3,1 DONE:PUSH R3 PUSH R1 RETURN

Aptitude test is quite diff... It will consist of 2 sections - analytical and maths.. maths section is too easy...Simple Ar , %age , Interest formulae ...simple calculations For the other section: 1) question of jumbled letter - find the category in which that word actually belongs to 2)question on series (odd one out) Practice really hard for sitting arangements type qs and do that qs if A goes then B , if C then D ...there is particular method to solve such qs ex :A causes B or C, but not both F occurs only if B occurs D occurs if B or C occurs E occurs only if C occurs J occurs only if E or F occurs D causes G,H or both H occurs if E occurs G occurs if F occurs 6. If A occurs which of the following must occurs I. F and G II. E and H III. D

(a) I only (b) II only (c) III only (d) I,II, & III (e) I & II (or) II & III but not both Ans. (e) 7. If B occurs which must occur (a) D (b) D and G (c) G and H (d) F and G (e) J Ans. (a) 8. If J occurs which must have occured (a) E (b) either B or C (c) both E & F (d) B (e) both B & C Ans. (b) 9. Which may occurs as a result of cause not mentioned I. D II. A III. F (a) I only (b) II only (c) I & II (d) II & III (e) I,II & III Ans. (c) 10. E occurs which one cannot occurs (a) A (b) F (c) D (d) C (e) J Ans. (b)

Q1: Output ? int main() { int i=-3, j=2, k=0, m; m = ++i && ++j || ++k; printf ("%d %d %d %d", i,j,k,m); return 0; }

Q2: Output ? int main() { int i=-3, j=2, k=0, m; m = ++i || ++j && ++k; printf ("%d %d %d %d", i,j,k,m); return 0; } Q3: Output ? int main() { int i=-3, j=2, k=0, m; m = ++i && ++j && ++k; printf ("%d %d %d %d", i,j,k,m); return 0; }

two rectangles are given. As a struct having {bottomleft-x, bottomleft-y, topright-x, topright-y} you are given two rectangles R1, R2? determine if they intersect

There is a channel which can send and receive signals and there is a sender and receiver. Sender can only send and receiver can only receive the message. Design classes for all three with the restrictions.
- devsri on July 03, 2012 in India | Report Duplicate

Design a base class that is uncopyable(need to take care of the = operator)

- devsri on July 03, 2012 in India | Report Duplicate

Questions on virtual methods and inheritence and C++

- devsri on July 03, 2012 in India | Report Duplicate

20

- devsri on July 03, 2012 in India | Report Duplicate

atoi() implementation.
- devsri on July 03, 2012 in India | Report Duplicate

There are coins of 25 10 5 and 1 Rs. You got to tell in how many ways you can make change for an amount X. A working code was required,
- devsri on July 03, 2012 in India | Report Duplicate

11

Find the first character in the given string that is non repeating --- O(n) solution expected
- devsri on July 03, 2012 in India | Report Duplicate

Delete a node in Lined List

- devsri on July 03, 2012 in India | Report Duplicate

Level Order traversal in BST

- devsri on July 03, 2012 in India | Report Duplicate

Print the path whose some is S

- devsri on July 03, 2012 in India | Report Duplicate

Depth of BST.
- devsri on July 03, 2012 in India | Report Duplicate

Considering all features in a notepad like insertion,deletion,searching etc . Which would be the best data structure to be used for a notepad and why ?
- Anonymous on July 02, 2012 in India | Report Duplicate

There is an unlimited stream of integer numbers . As soon as 500 comes in the stream stop and return all elements which came before 500 in an array. All elements should be stored at contigous memory location.
- Anonymous on July 02, 2012 in India | Report Duplicate

15

You are given intervals in form of Interval(i)={a(i), b(i)} where a,b are start and end points on a straight line. Given an array of intervals, Can you determine whether any such pair exist such that Interval(i) is contained in Interval(j). I told them the O(n log(n)) approach. If we have to find how many such pairs exist is it possible to do it in time less than O(n^2)?? What if i also have to print all such pairs??
- Yoda on July 01, 2012 | Report Duplicate

21

Every number ending in a 3 has a multiple which consists only of ones. Eg. 3 has 111, 13 has 111111, etc. You have to write a C function which will take a number ending in 3 and will print the multiple consisting of all ones. The data structure that you use should consist only of primitive data types. Remember that the multiple may overflow a computers integer range, your function should be able to handle this.
- shivi116 on June 25, 2012 in India | Report Duplicate
Adobe Software Engineer / Developer Algorithm

17

There are 'n' vertices and 0 edges of an undirected graph. What is the maximum number of edges that you can draw such that the graph remains disconnected.
- shivi116 on June 25, 2012 in India | Report Duplicate
Adobe Software Development Manager Data Structures

22

if infinite streams of 1's and 0's are coming, give an algorithm to compute the remainder of current number formed by them after dividing it by 5....you cannot store whole stream..
- himanshu on June 25, 2012 in India | Report Duplicate

24

how can you implement an abstract class in c++ without using pure virtual functions....??
- himanshu on June 25, 2012 in India | Report Duplicate

a gold sheet is given to you and different kind of shapes are given (shapes are not regular), you have to cut those shapes from the gold sheet such that there is minimum scrap i.e. minimum wastage of gold sheet.
- shivi116 on June 25, 2012 in India | Report Duplicate
Adobe Software Development Manager Brain Teasers

10

Given set of N integers (both +ve and -ve), find the continuous subset where the sum is maximum. Return the start and end indices.
- nehadhardce on May 29, 2012 in India | Report Duplicate

Given random integers in N number of files , with each file having set of integers (count different in each set). To find if the sum of all these integers divisible by 8 or not ? Optimize your solution.
- nehadhardce on May 29, 2012 in India | Report Duplicate

14

You have a list of coins of some denominations(d1<d2...<dk). You have unlimited supply of these coins. Find out the how can u make a sum S using minimum number of coins. DP solution was required as he was not satisfied with greedy approach.
- anuj.iiit2007 on May 27, 2012 in India | Report Duplicate

write a program for consumer and producer threads accessing shared queue, given primitives CreateEvent EnterCriticalSection/ EndCriticalSection Sleep Wait SetEvent etc
- topjobsncr on May 26, 2012 in India | Report Duplicate

Write a code that will check whether the memory allotted to the program at the initial and the memory returned to the system is same or not.
- my android app URL: getjar.com/todotasklist on May 04, 2012 in India | Report Duplicate
Adobe Software Engineer / Developer C

What happens if you make a field both final and volatile?

- irraju on April 29, 2012 in India | Report Duplicate

21

Write an algorithm to split a circular linked list two linked list with equal no of nodes
- brijithb on April 25, 2012 in India | Report Duplicate
Adobe Software Engineer / Developer Data Structures

35

Given N points(in 2D) with x and y coordinates. You have to find a point P (in N given points) such that the sum of distances from other(N-1) points to P is minimum.
- my android app URL: getjar.com/todotasklist on April 24, 2012 in India | Report Duplicate
Adobe Software Engineer / Developer Algorithm

27

given an unsorted array of integers. given d. U need to find all the pairs having difference d. I solved in nlogn. any better algo.
- my android app URL: getjar.com/todotasklist on April 23, 2012 in India | Report Duplicate

10

there are two processes p1 & p2 P1 : read the file

P2 : modify the file how will u synchronize the process so that modify can happen only when no one is reading the file. Using constructs Enter Critical Section : Exit Critical Section : Wait Event : Signal Event
- my android app URL: getjar.com/todotasklist on April 23, 2012 in India | Report Duplicate

Determine if the given string is of form pZq. q consist the reverse of p. and p and q will consist only X and Y. for ex. p=XYXX and q=XXYX(reverse of p). then string XYXXABXXYX is a valid string. The constraint is : you can access only next character at each point.

13

You are given a binary tree ( a general binary tree ) and not binary search tree, you have to find the node which is the lowest common ancestor of both these nodes. Can we perform better if it is a binary search tree?
- ashok.singh.sairam on August 26, 2012 in India | Report Duplicate

Given two char arrays X="ZTANBMBLAUCY " and Y ="GABVCBKLAMNC", write an algorithm to find the longest subsequence that is present in both of them. In the above case the common subsequence is "ABBAC". Also describe the time complexity of your algorithm.
- ashok.singh.sairam on August 24, 2012 in India | Report Duplicate

50

N*N matrix. contains only 0's and 1's. every row is sorted in descending order. find row containing maximum no of 1's. Efficient soln reqd.
- kb on August 13, 2012 in India | Report Duplicate

12

You have a database table Emp with data as follows: EmpId FirstName LastName 1 Bob Lync 2 Sarah John 3 Bob Lync 4 John Doe 5 Stanly Jeff 6 Sarah John With a single sql query, how will you cleanup the database (eliminate redundant data from above table)
- matrix on July 31, 2012 in United States | Report Duplicate
Adobe Software Engineer in Test Database

10

Which data structure will you use for creating a real world dictionary?
- matrix on July 31, 2012 in United States | Report Duplicate
Adobe Software Engineer in Test Data Structures Java

You have a sorted circular linked list and a sorted linear linked list. Write a program to merge these two arrays and create a new sorted circular linked list
- matrix on July 31, 2012 in United States | Report Duplicate
Adobe Software Engineer in Test Data Structures Java

17

Calculate circumference of a tree going clockwise and anticlockwise?

- Yoda on July 17, 2012 in India | Report Duplicate

14

Implement LRU cache?

- Yoda on July 15, 2012 in India for PSE | Report Duplicate

10

How would you implement Singleton pattern in a multi-threaded environment?

- Yoda on July 15, 2012 in India for PSE | Report Duplicate

13

there are list of random numbers like 1,3,23,76,908,34,256,12,43,11,2,-10 given an input suppose:13 find the combination of the numbers which adds up to 13.like 1+12=13,23+(10)=13..like that
- sarthakiter on July 11, 2012 in India | Report Duplicate

12

write a program so that it'll find all the possible combination of a string avoiding palidromes example:if the input is:"abcde" output would be:"a","b","c","d","e","ab","ac","ad","ae","bc","bd","be","cd","ce","de","abc","abd","abe",... but if you have already "abc",dont create"cba"
- sarthakiter on July 11, 2012 in United States | Report Duplicate

13

write a program so that the input be a no suppose 5 it will give output as 1+2*2+3*3*3+4*4*4*4+5*5*5*5*5
- sarthakiter on July 11, 2012 in India | Report Duplicate

29

An array arr[] has coins of several denominations. Given the array and a required Sum find the minimum number of picks to get that sum. eg: Input: {1,3,10} Sum required = 11 Output: 1+10 => 2 pickings
- Aryan on July 09, 2012 in India | Report Duplicate

12

Yoda speaks in a jumbled language. Say " Newyork must go we to now". FInd the minimum number of swaps to convert this to proper sentence say "we must go to newyork now". This is similar to minimum swaps to convert string A to string B. where

A, B are permutation of each other? Is there a decisive method? I tried using merge sort and selection sort and both time the answers varied.
- Yoda on July 05, 2012 in India | Report Duplicate

By using core dump file, how do you traverse a linked list. i.e you got a core dump file while printing the linked list with head pointer. suppose at node number 40000, each node has an unique identification number(lets say id starts with 1 to 100000, i.e 1 lac nodes are there in the list), I want to see the node content with identification number 122. You have only coredump file and sorce code file with you. You are working with core dump file now.
- sse on July 05, 2012 in United States | Report Duplicate

Write the code for mutex in c that is threadsafe

- devsri on July 03, 2012 in India | Report Duplicate

There is a stream of numbers and you need to find the maximum k numbers at any instant when minimum of k numbers have passed.
- devsri on July 03, 2012 in India | Report Duplicate

Prove that addition of consecutive odd numbers from 1 will result in number that is the square of the count of numbers added. e.g. 1+3+5 = 9 here count is 3 and the sum is 3^2 = 9 Give a mathematical proof
- devsri on July 03, 2012 in India | Report Duplicate

30

Write a code to in place sort the strings of the type "s1d3b2m0" to "sdbm1320". Solution must be of O(n) without the use of extra space. At max one temp variable could be used.
- devsri on July 03, 2012 in India | Report Duplicate

Effect of synchronize keyword in static and non-static methods in java

- devsri on July 03, 2012 in India for Lifecycle | Report Duplicate

28

There are 25 horses. A group of maximum 5 can only be made. You need to find the best three horses in minimum number of races
- devsri on July 03, 2012 in India for Lifecycle | Report Duplicate

13

There are three people and they need to know the average of their salaries without knowing each other's salary. How will you do that?
- devsri on July 03, 2012 in India for Lifecycle | Report Duplicate

What is MVC model.

- devsri on July 03, 2012 in India | Report Duplicate

How is Java different from javascript.

- devsri on July 03, 2012 in India | Report Duplicate

Divide a trapezium in 4 equal parts

- devsri on July 03, 2012 in India | Report Duplicate

12

There are two person A with Lock L1 and B with Lock L2 and a messenger M two send the box from one end to another. How to send the box so that M can never open the box.
- devsri on July 03, 2012 in India | Report Duplicate

What is the difference between a programming and scripting language.

- devsri on July 03, 2012 in India | Report Duplicate

17

There is an ant in a cube placed at one corner and you need to find the shortest path to the diagonally opposite corner. The ant can not fly tht is obvious.
- devsri on July 03, 2012 in India | Report Duplicate

Questions on Unions and its initialization and its memory usage.

- devsri on July 03, 2012 in India | Report Duplicate

How to implement classes in C

- devsri on July 03, 2012 in India | Report Duplicate

Page: 1 2 3 4 5 6 7 8 9 10 Filter:

14

How to build a heap from inoder traversal ?

- Anonymous on July 09, 2011 | Report Duplicate
Adobe Software Engineer / Developer Algorithm

15

There is a river and there are n number of steps between two banks of the river to cross the river. A frog wants to cross the river with the condition that he can jump max one step. Find the number of ways he can cross the river? For e.g. if there are 3 steps in between, frog can go from paths: _123_, _2_, _13_ so there are 3 different ways frog can cross the river (in the example _ is two ends of the river)
- alpeshvesuwala on July 06, 2011 | Report Duplicate

largest unique substring in string efficiently

- Priti on July 04, 2011 | Report Duplicate
Adobe Software Engineer / Developer Algorithm

What is virtual memory?

- technew on June 18, 2011 | Report Duplicate
Adobe Software Engineer / Developer Operating System

write a program for consumer and producer threads accessing shared queue, given primitives( written test) CreateEvent EnterCriticalSection/ EndCriticalSection Sleep Wait SetEvent etc
- truecool on June 15, 2011 | Report Duplicate

write a function which allocates two dimensional array dynamically int ** allocate(int row, int col)

- truekool2 on June 15, 2011 | Report Duplicate

10

1) write declaration of sprintf 2) difference between typedef and #define 3)how free remembers how many bytes to delete 4)write a macro for swapping two values of same data type
- truekool2 on June 15, 2011 | Report Duplicate

13

given power(x,y)implementation, find number of multiplications in power(5,12)( written test) int pow(int x, int n) { if(n==0)return(1); else if(n%2==0) { return(pow(x,n/2)*pow(x,(n/2))); } else { return(x*pow(x,n/2)*pow(x,(n/2))); } }
- truekool2 on June 15, 2011 | Report Duplicate

suggest a data structure for storing polynomial.Now write a program to add two polynomials.( written test) ax+ bx^2 + cx^3+...
- truekool2 on June 15, 2011 | Report Duplicate

12

print all paths from root to leaves( written test)

- truekool2 on June 15, 2011 | Report Duplicate

- truekool2 on June 15, 2011 | Report Duplicate

You can concatenate A to A, and search B in the resulted string using an O(n) algorithm, KMP, Boyer Moore.
- wfchiang on May 23, 2011 | Report Duplicate

Write your own strtok(sting,token) function..O(n^2). Follow Up Then write O(n) version of it.. interviewer strictly asked to write O(n)..??
- Rama on May 22, 2011 | Report Duplicate
Adobe Software Engineer / Developer Algorithm

25

Given an array A[i..j] find out maximum j-i such that A[i]<a[j] in O(n) time.
- Rama on May 19, 2011 | Report Duplicate
Adobe Software Engineer / Developer Algorithm

20

Imagine there are infinite number of Queens (Chess Game Piece) with u. Find the minimum number of queens required so that every square grid on the chess board is under the attack of a queen. Arrange this minimum no. of Queens on a chess board.
- ilovealgo on May 13, 2011 | Report Duplicate
Adobe Software Engineer / Developer Brain Teasers

- HardyBoy on May 10, 2011 | Report Duplicate

16

You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e.g., M becomes a substring of N located at i and starting at j). EXAMPLE: Input: N = 10000000000, M = 10101, i = 2, j = 6 Output: N = 10001010100 _ ________________________________________________________________

- Algoseekar on April 29, 2011 | Report Duplicate

Adobe Software Engineer / Developer Bit Manipulation

Write a function int triangle(const vector<int> &A); that given a zero-indexed array A consisting of N integers returns 1 if there exists a triple (P, Q, R) such that $0 \leq P < Q < R < N$ and A[P] + A[Q] > A[R], A[Q] + A[R] > A[P], A[R] + A[P] > A[Q]. The function should return 0 if such triple does not exist. Assume that $0 \leq N \leq 100,000$. Assume that each element of the array is an integer in range [1,000,000..1,000,000]. For example, given array A such that A[0]=10, A[1]=2, A[2]=5, A[3]=1, A[4]=8, A[5]=20 the function should return 1, because the triple (0, 2, 4) fulfills all of the required conditions. For array A such that A[0]=10, A[1]=50, A[2]=5, A[3]=1 the function should return 0
- xcx on April 24, 2011 | Report Duplicate
Adobe Software Engineer / Developer Algorithm

11

What's the complexity of the following code? int fib(int n){ if(n==0||n==1){ return 1; } return fib(n-1)+fib(n-2); }
- Anonymous on April 21, 2011 | Report Duplicate
Adobe Software Engineer / Developer Algorithm

22

Formatting was incorrect so posted again. Consider the given structure: struct node { int data; struct node *next; struct node *next_larger; } You are given a list where each node is of type defined above. Initially all the next larger pointer of each node points to NULL. Write an algorithm to update the next larger pointer of each so that they point to immediate next largest node in the list. e.g.

- Riya on April 17, 2011 | Report Duplicate

Write the code for Dijkstra algorithm using adjacency list representation. What is the running time? What will be the running time if adjacency matrix representation is used?
- vinay on April 08, 2011 | Report Duplicate

14

Write an algorithm that finds the contiguous subsequence of elements in an array with largest sum. The elements in the array can be negative. Is there a O(n) solution for it? Any good solutions are very much appreciated.
- Ajai on March 27, 2011 | Report Duplicate

many irregular shape objects are moving in random direction. provide data structure and algo to detect collision. Remember that objects are in million.

- gavinashg on March 22, 2011 | Report Duplicate

Adobe Software Engineer / Developer Algorithm

22

A frog has to cross a river. There are n rocks in the river, using which the frog can leap across the river. On its way across the river the frog can chose to skip a rock, but it cannot skip two consecutive rocks because that would be two far a distance for the frog to hop, also the from would not skip the first rock and the last rock. E.g. if there are 3 rocks, 1,2,3 and 4, there could be three following routes it could take: 1,2,3,4 1,2,3,4 1,3,4 1,2,4 Write a recursive algorithm, that takes a number of rocks' and prints all the feasible paths. Ofcourse there can be other arguments too.
- CuriousMe on March 19, 2011 | Report Duplicate
Adobe Software Engineer / Developer Algorithm

19

There is a circle enclosed in a square,such that it is touching all the four sides of the square. In the top left space between square and the circle, there is a rectangle with length 14 and breadth 7, such that top left corner of the rect is the top-left corner of square and bottom right corner lies on the circumference of the circle. What is the radius of the circle?
- CuriousMe on March 19, 2011 | Report Duplicate
Adobe Software Engineer / Developer Brain Teasers

10

There is a 2X4 matrix, in this you are supposed to arrange the numbers from 1-8, so that no consecutive numbers are adjacent(vertically, horizontally and diagonally) to each other. It is possible to do if one keeps on trying it randomly but it can be done with an intelligent approach too. What would that be?
- CuriousMe on March 19, 2011 | Report Duplicate
Adobe Software Engineer / Developer Brain Teasers

13

Count No of Set bits in Number in O(1)..yes its possible interview told me

- Algo_boy on March 16, 2011 | Report Duplicate

16

you have a sequence where each number is a multiple of 2 or 5 (so: 2^i * 5^j). Given the beginning of the sequence as 1,2,4,5,8,10,16... and find a algorithm to calculate the next number in the sequence?
- Algoseekar on March 09, 2011 | Report Duplicate