# Strategies To Gain U.S Based Clients

If you are a programmer from India, Bangladesh, Pakistan, or any other country that is not the U.S, you may find breaking into that market difficult.  If English is not your first language, or American or British English isn’t, it’s important to make sure your project bid is written in a way that shows you […]

# How To Prepare For A Coding Job Interview

Landing a job in the tech field can be difficult, especially if you shooting for jobs at major companies like Facebook or Google.  In fact, if you are applying to Facebook, you will be put through a series of targeted coding questions on the spot.  So whereas some companies may give you a coding test […]

# Implement strstr

Question: Implement strstr in Java. Find the first instance of a string in another string. Answer: public int Search(String haystack, String needle){ for(int i = 0; i < haystack.length(); i++ ) { for(int j = 0; j < needle.length() && i+j < haystack.length(); j++ ) { if(needle.charAt(j) != haystack.charAt(i+j)) { break; } else if (j […]

# Search in a sorted rotated array

Question: Implement a search function for a sorted rotated array. Duplicates are allowed. Returning any one of the duplicates is acceptable. Answer: We can do a binary search with some modified checks. public int rotatedSearch(int[] values, int start, int end, int x){ if(values[start] == x){ return start; } else if(values[end] == x){ return end; } […]

# Queue Using Stacks

Question: How would you use stacks to implement a queue? Answer: So how could we go about doing this? What if we used two stacks and used one as the incoming stack and the other as the outgoing stack? A queue is a FIFO structure, so when we enqueue something, we need to make sure […]

# Combinations of a String

Question: Write an algorithm to print all possible combinations of characters in a string. Answer: Any thoughts? One thing is for sure, we can definitely use some recursive logic here. Let’s approach this problem methodically. Since we need to generate combinations, we can start with a single character and then continue to add a character […]

# First Non-Repeated Character

Question: Write an algorithm to find the first non-repeated character in a string. For example, the first non-repeated character in the string ‘abcdab’ is ‘c’. Answer: Seems trivial enough right? If a character is repeated, we should be able to search the string to determine if that character appears again. So if we go about […]

# Number of Ones

Question: Write a function that determines the number of bits set to 1 in the binary representation of an integer. Answer: Going by the brute force approach, it would be easy to come up with the following solution. If the least significant bit of a number is 1, it will return a result of 1 […]

# Anagrams in an Array of Strings

Question: You are given an array of strings and you are asked to display all the anagrams within the array. For those who don’t know, two words are anagrams if they contain the same characters. Answer: The brute force solution would be to take each string and compare it to every other string in the […]

# Permutations of a String

Question: Print all the permutations of a string. Write code in C. Answer: Here is a recursive solution to print all the permutations of a string. However, this solution does not take care of duplicates. It is assumed that there are no duplicates in the string. I left out the implementation of the swap method […]