alregith
BAN USERIf loops and for loops are bread and butter for me.
- 0of 0 votes
AnswersWrite a program to print the below series:
- alregith in United States
1 11 21 1211 111221 312211 13112221 ....
Another example of the series:
12 1112 3112 132112 1113122112 ....
You will be given a number. You will have to print the first ten numbers in the series. The series is basically the number of occurrence followed by the number. The occurrence should be continuous.| Report Duplicate | Flag | PURGE
Epic Systems Software Developer - 0of 0 votes
AnswersYou are given an N*N matrix. The matrix contains characters. Write a program to find a word in the matrix.The word can be found in either the rows or columns or the diagonals. The program should return true if the word is found and false if the word is not found.
- alregith in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Arrays - 0of 2 votes
AnswersGiven ten million numbers, each having 11 bits, find the most time efficient way to sort the numbers.
- alregith in United States for Marketplace Team| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersGiven an array and a number, find two integers that sums to the given number.
- alregith in United States for Marketplace Team| Report Duplicate | Flag | PURGE
Amazon SDE1 Arrays - 2of 4 votes
AnswersGiven two sorted arrays, find the median of each array. The length of the arrays are m and n and we should not use extra buffer. We should find the median and time complexity should be less than 0(M+N);
- alregith in India for Chennai| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Data Structures
public static long findMaxNumber(long num)
{
long maxNumber = 0,placeValue=1;
long temp;int count=0;
int hashMap[] = new int[10];
temp = num;
while(temp!=0)
{
hashMap[(int)temp%10]++;
temp=temp/10;
}
for(int i=0;i<hashMap.length;i++)
{
count=hashMap[i];
while(count>0)
{
maxNumber=maxNumber+placeValue*i;
placeValue=placeValue*10;
count--;
}
}
System.out.println(maxNumber);
return maxNumber;
}
- alregith March 23, 2015