top of page
Search
Abhinaw Tripathi
Jun 17, 20161 min read
ArrayList Class Collection Java
ArrayList Class An ArrayList is like an array, which can grow in memory dynamically.Memory is dynamically allotted and re-allotted to...
4 views0 comments
Abhinaw Tripathi
May 25, 20161 min read
Amazon Interview Question: Assume you have a method isSubstring which checks if one word is a substr
Let say you have two string s1 and s2 ,write code to check if s2 is a rotation of s1 using only one call to isSubstring(eg. "WaterBottle"...
104 views0 comments
Abhinaw Tripathi
May 25, 20161 min read
Very Common Problem on Matrix,if an element in an MXN matrix is 0,its entire row and column are set
Solution: public void setZero(int[][] matrix) { boolean[] row= new boolean[matrix.length]; boolean[] row= new...
4 views0 comments


Abhinaw Tripathi
May 25, 20161 min read
Write a method to rotate the image by 90 degree.(In place operation is required).
Let say you have an image represented by an NXN matrix where each pixel in the image is 4 byte.So rotate this image in place by 90...
3 views0 comments
Abhinaw Tripathi
May 25, 20161 min read
Write a method to perform basic string compression eg. aabcccccaaa.Should become the ouput a2b1c5a3.
Bad Solution: public String compressBad(String str) { String mystr= ""; char last=str.charAt(0); int count = 1; for(int i=1; i<...
13 views0 comments
Abhinaw Tripathi
May 25, 20161 min read
Write a method to replace all spaces with %20 in a String.(Note-Perform in place operation only.)
public void replaceSpaces(Char[] str, int length) { int spaceCount=0; int newLength,i; for(i=0;i<lenght;i++) { if(str[i] == ' ') {...
6 views0 comments
Abhinaw Tripathi
May 25, 20161 min read
How will you check,given two strings are permutation of the other.
Example: "god" permutation will be "dog" Solution: public String sort(String s) { char[] content = s.toCharArray();...
2 views0 comments
Abhinaw Tripathi
May 25, 20161 min read
Programming Questions on String and its Best Solution with its complexity
Question: Write an algorithm to find if a string has all unique characters.what if you cannot use additional data-structure?. Solution: i...
5 views0 comments
bottom of page