leetcode
codility
hackerrank
Some personal tips based on my experience alone. You don't have to agree with it. Consider it an an opinion.
Job will be earned not given. No one is going to give you anything. It will not be free. You will have to work for it. There is not one fixed path to finding a job. You have to make your own path depending on your personality, your interests. Below are some tips and that's all they are. Use them if they help you but feel free to discard them if it's not working for you.
1) Numbers game. Attend every interview. Sometimes the requirements will be overwhelming . If you know some things that will be good enough. Focus on the positive . You will not be able to answer all the questions. Stay confident. ( Examples of State job... )
2) Be determined but not desperate. Don't beg for the position. You can state that you are a hard worker and will be an asset to the company. You know you will do well.
3) It's the real world. There will many rude and indecent people you will encounter. Keep your cool. You need the job . ( Examples Stenograph, Kaiser )
4) Make it a learning experience. What technical questions did they ask. Take a blank piece of paper with you.Write down the questions they ask. If you did not answer some of the questions revise the material. Usually you will find the technical questions are very similar if not the same.
5) Always leave a gap of few days before a phone or an in-person interview. Read the basics of the technical relevant material. Do not miss out on the basic questions. Read about the company. What sort of business are they in. The more you know the more confident you will be. Stay focused and determined. Don't overthink. Don't stress out.
6) Change your habits to be hard working oriented. Get up early. Read as much as you can technically.
7) Don't take rejection personally. You are competing with other people. You will not get every job you try for. Don't resort to anger. World is not fair. It's a cruel, unfair world. Stay aggressive, humble and determined. For every 20 rude people there will be 1 good person. You only need 1 opportunity.
( SF, Walnut Creek )
8) Dress appropriately. You may not judge people by dress but you will be interviewed by many people. Don't give them an excuse. This job will put food on your table. Make it the most important event you can.
9) Don't underestimate social dynamics of a job interview. There might be cultural differences. Stay confident and don't be intimidated . ( license place IIT )
10) Make sure to pass the online coding interview if one is given to you.
11) Prepare some things beforehand. One thing they always ask. What are your weaknesses ? Sometimes I am impatient when things need to get done. ( It's a positive in an indirect way. ) What questions do you have for us. How is the company doing financially ? Is it very fast paced environment. Is there a lot of pressure. Is there a dress code. Are there company events ? Are there cubicles. What are the timings ?
12) Prepare the references. Where is the place you are going for. Look at the maps beforehand. Take out what you are going to wear.
13) Never answer in the negative. Do you know Sybase Databases.? I am familiar with Oracle Database and am sure I can pick the Sybase Database up quickly. I am a fast learner and am a hard worker .
14) Meet the manager , director . Get a feel of their personalities. Interviewing takes social skills as well as technical skills.
15) Stay focused . Stay determined. Learn from your mistakes. You can't change the system but you can change yourself.
https://drive.google.com/open?id=1LpZh-HBCSTBZNDsWPF6dswxfBSlF9NS0
1)
Given an array find the maximum difference between two elements such that the element we are subtracting is the element to the left.
Ex:
3 7 10 1 5 20
The max difference is 20 -1 which is 19 .
2)
We are given a single array that represents a 2 dim array. The single array in the first element contains the row size followed by the rows. The single array starts with 0 index.
Ex:
2 10 20 100 200 400 500
In the above the first element 2 represents the row size . The 2 dim matrix is :
10 20
100 200
400 500
Next we are given a pair represent the row column and the column number. The numbers start with index 1.
So for the above case:
1 1 we get 10
1 2 we get 20
3 2 we get 500
We are to write a function that given the single dimensional array and 2 row and col values will return a single integer representing the value in the 2 dim array .
3)
Write 3 classes:
import java.util.*;
interface Rectangle {
public int area(int height, int width);
}
interface Circle {
public double area(int radius);
}
class Geometry implements Rectangle, Circle
{
public int area( int height, int width )
{
return ( height * width ) ;
}
public double area( int radius )
{
return ( 3.14 * radius * radius ) ;
}
}
// Write your code here. DO NOT use an access modifier in your class declaration.
public class Solution
{
public static void main(String[] args)
{
Geometry g = new Geometry();
System.out.println("I implemented: ");
implementedInterfaceNames(g);
Scanner in = new Scanner(System.in);
int height = in.nextInt();
int width = in.nextInt();
int radius = in.nextInt();
System.out.println("Rectangle area = " + g.area(height,width));
System.out.println("Circle area = " + g.area(radius));
in.close();
}
/*
* Takes an Object and prints the name of the interfaces it implemented
*/
static void implementedInterfaceNames(Object o)
{
Class[] interfaces = o.getClass().getInterfaces();
Arrays.sort(interfaces, new Comparator<Class>() {
public int compare(Class o1, Class o2) {
return o1.getName().compareTo(o2.getName());
}
} );
for (Class c : interfaces) {
System.out.println(c.getName());
}
}
}
4) We have a string say "argentina"
We are given a character say "a". We are to find the minimum distance in the original string from the given character.
Our answer should be:
0 1 2 3 4 3 2 1 0
5)
We have a 2 dimensional array and we have to print the numbers in a spiral.
6)
Find the kth largest element in an array. Use heap sort to get an order of k log n .
7) Reverse k elements from a Jaa queue.
8) Fibonacci number Find the last digit of the sum .
9) Write a recursive function to find product of 2 numbers.
10) Find if a loop exists in a linked list. Create a linked list in Java.
11) Find the longest prefix in an array of strings.
12) Implement a Singleton C++ class.
13) strcpy C++ src destination . Palindrome
14 ) Threadlocal. Amadhal's law.
15) Mergesort , Find kth largest without sorting.
16) In an array of 1's and 0's shift the zeroes to the left.
17) Hibernate questions
What is lazy loading. How to lock an object.
What is cache.
18) Multithreading
What is ThreadLocal ? What is Amadahls law ?
1)
import java.util.* ;
public class max1
{
/* The function assumes that there are at least two
elements in array.
The function returns a negative value if the array is
sorted in decreasing order.
Returns 0 if elements are equal */
int maxDiff1(int arr[], int arr_size)
{
int max_diff = arr[1] - arr[0];
int min_element = arr[0];
int i;
for (i = 1; i < arr_size; i++)
{
if (arr[i] - min_element > max_diff)
max_diff = arr[i] - min_element;
if (arr[i] < min_element)
min_element = arr[i];
}
if ( max_diff < 0 )
max_diff = -1 ;
return max_diff;
}
int maxDiff(List<Integer> a1 )
{
int[] myArray = new int[a1.size()];
for(int i1 = 0; i1 < myArray.length; i1++ )
myArray[i1] = a1.get(i1);
int arraySize = a1.size() ;
int max_diff = myArray[1] - myArray[0];
int min_element = myArray[0];
int i1;
for (i1 = 1; i1 < arraySize ; i1++)
{
if (myArray[i1] - min_element > max_diff)
max_diff = myArray[i1] - min_element;
if (myArray[i1] < min_element)
min_element = myArray[i1];
}
if ( max_diff < 0 )
max_diff = -1 ;
return max_diff;
}
/* Driver program to test above functions */
public static void main(String[] args)
{
max1 maxdif = new max1();
//int arr[] = {1, 2, 90, 10, 110};
// int arr[] = {1, 2, 6, 4};
int arr[] = {60, 40, 20, 10};
int size = arr.length;
System.out.println("MaximumDifference is " +
maxdif.maxDiff(arr, size));
}
}
2)
import java.io.*;
import java.util.*;
public class array1
{
public static void main(String args[] ) throws Exception
{
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
Scanner in = new Scanner(System.in);
int noElements = in.nextInt() ; //Integer.parseInt( in.nextLine() ) ;
int[] arr1 = new int[noElements] ;
for( int i1=0 ; i1 <noElements ; i1++ )
{
arr1[i1] = in.nextInt() ;
//System.out.println( arr1[i1] ) ;
}
int numberOfInputs = in.nextInt() ;
int[] x1 = new int[numberOfInputs] ;
int[] y1 = new int[numberOfInputs] ;
for( int i1=0 ; i1 <numberOfInputs ; i1++ )
{
x1[i1] = in.nextInt() ;
y1[i1] = in.nextInt() ;
//System.out.println( arr1[i1] ) ;
}
int index ;
int rowSize = arr1[0] ;
for( int i1=0 ; i1 <numberOfInputs ; i1++ )
{
//System.out.println( x1[i1] + " : " + y1[i1] ) ;
index = (x1[i1]-1 ) * rowSize + y1[i1] ;
System.out.println( arr1[index ] ) ;
//System.out.println( arr1[i1] ) ;
}
}
}