↳
I first assumed that both numbers were positive and then used repeated subtraction to come up with the answer. Upon further discussion I felt that this took too long and tried to come up with some kind of faster method to accomplish this but I could not design it in the time required. Thinking about it there are some other choices: 1) Treat the numbers as binary and then use shifting and subtraction to divide. I can't really solve this easily. 2) Calculate ..., 16m, 8m, 4m, 2m, 1m, etc. and the subtract each of those from n if possible. If you can subtract it shift the answer and add a 1. Finally, compare the signs of n and m to set the signs of the answer. Less
↳
10 ^ (log10 m - log10 n)
↳
The two answers don't give you the remainder; you will still have to write code to get that Less
↳
Create a stack. Traverse the string and push the characters onto the stack until a space is encountered, then print all the characters off the stack until it's empty. When the end of the list is reached, empty and print the stack. Less
↳
I know that a Java answer isn't always what MS likes to hear. However, the technique is essentially the same if it's C#, C++, or even C. Extracting the tokens from the string and reversing them in the same order as the original string is the trick. ---------------------------------------------- import java.util.StringTokenizer; public class MsTest { public static void main(String[] args) { // TODO Auto-generated method stub String aString = "ABC 123 Doe Ray Me Fala=la 890"; System.out.println( "Original String: " + aString ); StringReverseElements( aString ); } private static void StringReverseElements(String Mess ) { StringTokenizer st = new StringTokenizer (Mess, " "); String tmpString; System.out.print( "Reversed String: " ); while (st.hasMoreTokens ()) { tmpString = (st.nextToken()); PrintReverse( tmpString.toCharArray(), tmpString.length()); } } private static void PrintReverse( char[] AnArray, int iLen ) { for ( int kk = 0; kk < iLen; kk++ ) System.out.print( AnArray [ iLen - kk -1] ); System.out.print( ' ' ); } } Less
↳
Clay - That would absolutely work, but during my interview I was told I couldn't use library functions, including Tokenizer. Less
↳
Divide the coins into 3 piles of 3. Weigh the first 2 piles. If they balance then the heavier coin is in the 3rd pile otherwise its on the balance beam. Take the heavier pile and place 1 coin on each end of the beam. If they are equal then the heavier coin is the 3rd coin else it is on the beam. Less
↳
OMG... It says the last coin was heavier! FIND THE LAST COIN...duh!
↳
@ranee : The answer given is correct. If the heavier coin is in the 3rd pile , then take any two from them and weigh them . If they are equal , you can easily say the last coin is the heaviest , otherwise the heaviest coin is one of the two being weighed. If in the first go , you can get hold of the heavier pile , do the same procedure as above. You can easily find it by using the balance twice. Less
↳
What were the interview questions?
↳
I am E.E student it's my 2nd semester but i think , how i will clear the test and how i will be able to do job in practical life?? Because here in engineering they just teach us theory and some little work. On completionof this degree how some one directly can able to do so. Kindly inform me. Thnks Less
↳
Tell us home many questions come in engineering test and is it's such a difficult test yes or no? And question on mcqs type? Less
↳
The feasibility which could lead to happen this type of situations is due to critical business needs. It means senior management would be actively involved and here agile framework will come into play. Delivering the workable product and then further developing the solution would be the best possible shot for win win situation. Less
↳
It is possible to keep scope, resources & timeline (dates) unchanged, but compromise on quality. This will impact team retention, especially the stronger engineers on the team, over the longer run. The leadership team must understand the consequences. Less
↳
Give them the choice of reduced scope, more resources, or changed dates. They can only pick 2. Less
↳
How about building a prefix tree and keep the frequency at the leaf of the tree?
↳
Of course having a hashmap or an associative array would be a naive way. They are looking for optimization. Probably either using a hashmap but in a multithreaded way or having a more optimized algorithm that involves uncommon data structures Less
↳
I answered that I would build a hash map where the key was each word encountered and the "value" was the number of times that word was encountered. O(n) complexity. Less
↳
I didn't know.
↳
It's located at path C:\Windows\
↳
C:\Windows\Assembly\GAC_MSIL
↳
A distributed system is where components located on a network communicste by passing messages passing messages. The components interact with each other in order to achieve a common goal. Less
↳
while some answer is fine, this is just an opener to a wider question the interviewer is trying to drive at. A good answer would briefly describe some theory of distributed systems and better bring out some experiences of building a distributed system. Preferably from personal experience OR definitely from something you have studied deeply. Less
↳
I didn't have experience with such systems. So, told the person.