shivi116
BAN USER- 0of 0 votes
AnswersThe character 'a' to 'z' are encoded as 1 - 26. Given a string of digits, compute the number of valid decodings of the string. For example, both 'aa' and 'k' can be encoded as '11'. Hence num_valid_encodings('11') = 2.
- shivi116 in India| Report Duplicate | Flag | PURGE
Algorithm - 0of 0 votes
AnswersGiven an array of positive integers of 2*n elements, you need to divide the array in two equal halves such that the sum of two halves are closest(or the difference of the sum is least). For e.g
- shivi116 in India
Array = {1,2,3,4,5,6,7,8,9,10}
The desired two halves will be :
{1,4,6,7,10} and {5,2,3,8,9}
Difference between two halves = |28 - 27 | = 1 which is least among all other combination's.
You can safely assume that sum of whole array < 10^6| Report Duplicate | Flag | PURGE
Algorithm - 1of 1 vote
AnswersEvery number ending in a 3 has a multiple which consists only of ones. Eg. 3 has 111, 13
- shivi116 in India
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.| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Algorithm - 0of 0 votes
Answersa 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 in India| Report Duplicate | Flag | PURGE
Adobe Software Development Manager Brain Teasers
hey..tell me whether dis algo will work or not...take one count variable for both arrays...now start trvrsng first array if next elemnt is less than current do count=count-1 else add 1...do same for second array...if both count value r same dey form same bst....dis one has to be done aftr chckng same value in both arrays,equal length and first elmnt is also equal....
- shivi116 July 02, 2012hey...tell me whether dis algo is working or not....take one count variable for each array and traverse array...if in array succedng value is less than cur value do -1 if grtr do +1 aftr trvrsng both array chck deir count value if they r same dey form same bst...dis algo is to be applied when both arrays has similar values and same length
- shivi116 July 01, 2012
let numbers be 1,2,3,......n den odd terms will be 1,3,5...2n-1 so total of n/2 numbers now applyng sum of A.P sum=(no.of terms*(first term+last term))/2 here no of terms is n/2 ,first term is 1 and last is (2*n/2-1)=n so sum=((n/2)*(1+n-1))/2=(n^2)/4 whihc is square of no of terms
- shivi116 July 04, 2012