[algogeeks] Re: question on fork()
Surprisingly, if I comment the last if condition ( which is AFTER red() call ), it is printing red only 6 times as expected.. http://ideone.com/XMHzC main() { fork(); int color=fork(); if(color==0) fork(); red(); //if(color==0) // fork(); green(); getch(); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/1o7KQKelcswJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Possible solutions to these sort of Questions
For questions specifically asking about test cases, I would suggest following 3 step approach: First think of a* basic flow that MUST work for the application* (what is expected with the application. Firstly make it clear with you interviewer). eg: 1) User should be able to open Notepad without any error/warning. 2) User should be seamlessly able to type characters. (should not be the case, where you are typing and it appears after some time) 3) Create one file using notepad, close the application and reopen the file. (make sure, result is as expected) ..and so on (try to cover all basic functionality). Also you can club few test cases. eg, for menu features you can say something like: verify that all menu options are working as expected. Now move one step ahead, and *think of a person who is not familiar with the application* (what would he do?): eg: 1) User should be able open the Help docs and help docs should be relevant. 2) If a user writes something, forgets to save and trying to close the application: Appropriate notification. 3) Trying to copy and paste with supported/unsupported format. 4) Drag/drop a file on the application. and so on... and then comes *negative test cases* (it may happen rarely but it is very important): eg: 1) Trying to open multiple instances of the application (application shouldn't act weird) 2) Crash the application and open it next time. It should open (may be with some notification), but the application SHOULDN'T CORRUPT. 3) Application behavior when you open very large file. (should give appropriate warning, if it is going to take longer time/crash) 4) behavior with unsupported file. (eg: trying to open a .out file) ..and so on... In my opinion, with this approach you will be able to write good test cases. Just think on the line above mentioned 3 steps. You may come with different test cases, but your test cases will also ensure that application is working fine in most of the cases. :) Any suggestions on above approach? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/POcIPzZSlbYJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Algorithms For Interviews
It was posted recently.. Check the achieves. :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Lv9GSMFFS00J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Algorithms For Interviews
Typo: achieves -- archives -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/ccCkVtfs3y4J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Array Problem
any O(nlogn) solution? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/7Q8DHLIlbDoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Closest ancestor of two nodes
Guys, How about the below mentioned implementation? The only assumptions is that nodes should exist in the tree. (will fail if one node exists and another doesn't) static Node LCA(Node root, int d1, int d2){ if(root==null) return root; if(root.left!=null ( root.left.data == d1 || root.left.data==d2 ) ) // both nodes exists in left sub-tree return root; if(root.right!=null ( root.right.data == d1 || root.right.data==d2) ) // both nodes exists in right sub-tree return root; Node ltree = LCA(root.left, d1, d2); //check recursively in left subtree Node rtree = LCA(root.right, d1, d2);// check recursively in right subtree if(ltree!=null rtree!=null)// One node in left another in right return root; return (ltree==null)?rtree:ltree; } Just to mention that, closest ancestor of 54 OR 49 would be 3 in the following tree: 3 \ 4 /\ 5 8 / 9 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/24JUUQsBHvIJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: fork() question
Check out second run of same code: http://ideone.com/TK4qu. This time it printed only 8 times. The reason behind this is that, you are using a web based compiler and it sends back the output as soon as main completes its execution. However forked child are yet to complete. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/TYDV9_VeO-QJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: an array question
@Ankur, what if the numbers are 23 232?? 23 add 0 == 230 Since, 232 230 === 232 should come first.. Hence answer: 23223. However; 23232 is greater.. wutta say? :-/ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/nGN5uaOM_u4J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: an array question
Not Sure! Me too looking for a solution.. :D So far, Kunal's approach (Convert each string to length max_size where you append it circularly) seems to be working fine. :-) ..and Chengjie's approach should also work, but the interviewer rejected this idea saying, he wants a good logic for this. :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/sRTcLi6r_IYJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: logic???????????
Yeah got it. Thanks :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/NAqtuyQmehgJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Need Pointers for dynamic programming concept problems
Hi! Any good source for dynamic programming problems (along with concept)?? No lmgtfy, Please. Direct links will be appreciated. Thanks -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/LTUJ9q1qTfUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Array question: Detect whether a circular chain with all elements can be formed
An array of strings is given and you have to find out whether a circular chain with all character can be formed or not? Circular chain is formed in way that: if last char of a string is equal to first char of another string then it can be joined.: like ab bxc === axbbxc (Notice that it got joined at b) example {asdsb,csasaa, bc} Answer: TRUE {asdsb,csasaa, bc, bc} Answer: FALSE -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/WGN5GLyIP_QJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Need Pointers for dynamic programming concept problems
@Raghavan, Thanks man :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/lGIZaHYTu3cJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] String Question
Me too didn't get Raghavan's algo... Pls explain.. It seems that above algo will find only longest sequence starting from index 0. Just a thought: Along with raghavan's algo, what if I keep and array_of_integers[string_length] and keep on storing the count in this array. Once string is traversed we have to find the max distance among two equal numbers in an array. (need to think on this problem as well) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/gWwbzXZ_B1sJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] n*n array
Hey, can anyone pls share logic/pseudo code for N*M? (When N can be less than or greater than M.) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/3mf8oCcnMH4J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: TREE question
... if(something) return true; else return false; . // few statements here . Will few statements ever execute?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/zTXTyMwcDGAJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Array question: Detect whether a circular chain with all elements can be formed
why following? if(first==last) return false; example: axxa, ayyb, bzza === ayybbzzaaxxa -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/iONquZUgbPkJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Algorithms for Interviews _scan ocr_.pdf
Kudos to Aditi. :D -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/gnhokgp_zV0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: citrix rd????
Typically first round is coding on paper. (they will ask you to code 2-3 problems.) Brush up bitwise operations ( shifting, and, or, xor), Strings Arrays problems. You may get tree/ll questions as well. but their solutions won't be too large. Like other companies, in interview, mainly DS/OS and few n/w questions; like TCP working, 3-way handshake etc.. Guys, any other info? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/AhFcKt7rLisJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Algorithms for Interviews _scan ocr_.pdf
Oh! come on. It is working! :) anyways, I have mirrored it at http://goo.gl/rbSNE Cheers! \o/ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/iHSvoolOJwgJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: citrix rd????
I havn't attended citrix's campus drive this year. This is the last year's process. Hopefully would be same. :) Good Luck! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/DNO8Dv_VAbAJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Algorithms for Interviews _scan ocr_.pdf
@gopi, Mirrored link http://goo.gl/rbSNE is also not working??? it is a 15.5mb file, will take some time to appear on browser (incase you r using FF). -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/FINt1ktVCUUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] logic???????????
@Sagar ..an array which is sorted but rotated by some k places which is nt kwn Kindly note that: ARRAY IS KNOWN, k is NOT known. If the array is not known then where will you search an item??? :P :P -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/TfoI2uYkGCAJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] an array question
An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
Kindly check it with both the examples. It won't work. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/VlT1DNH-vPkJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: an array question
@dave, Awesome approach. It was really tough to find a counter example. :D 1st number: 23 2nd number: 23235 Applying ur algo: 23 - 2 -- 23235 Answer using ur algo: 2323235 However the correct answer should be: 2323523 Am I missing something in the above example? :-/ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/tJyt_fkHU-kJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: logic???????????
how abt http://ideone.com/lN2og ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/pZdvFb_t2b4J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Bitwise operators
let say a=6; binary= 0110 b = ~a = 1001 Now when you print value of ~a or b, it is calculating 2's complement. 1's complement: 0110 2's complement: 0111 (value = -7) Pls check signed bit representation for details. On Aug 7, 4:40 pm, Shashank Jain shashan...@gmail.com wrote: bitwise complement operator (~), complements d digits of d input bt when i use it : int a,b; b=~a; output: its giving o/p such that b= -a-1; why is dat so? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Bitwise operators
8 bit was taken just for example. It can be 16/32 bit but that won't make any difference on leading 0's or 1's. On Aug 7, 5:28 pm, Shashank Jain shashan...@gmail.com wrote: y r we taking 8 bit numbers, i mean dat way we cant go beyond -127 to 127? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sun, Aug 7, 2011 at 5:39 PM, Yasir yasir@gmail.com wrote: let say a=6; binary= 0110 b = ~a = 1001 Now when you print value of ~a or b, it is calculating 2's complement. 1's complement: 0110 2's complement: 0111 (value = -7) Pls check signed bit representation for details. On Aug 7, 4:40 pm, Shashank Jain shashan...@gmail.com wrote: bitwise complement operator (~), complements d digits of d input bt when i use it : int a,b; b=~a; output: its giving o/p such that b= -a-1; why is dat so? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Bitwise operators
@Shashank, You didn't get it properly. If leftmost bit *0*, then it is a *+ve* number. If it's *1* then it's a *-ve* number. Let's take above example with 16 bit: a=6 binary: 0110 (note that leftmost bit is 0, so it's +ve number) ~a= 1001 (now leftmost bit is 1, so compiler will treat it as -ve number.) To obtain its *-ve decimal value* you need to calculate it's 2's complement. (note that the value obtained with 2's comlement would be - ve). Also you can cross verify that ~a represented above is -7. Simple math -7 +7 =0; 1001 0111 -- 0 Kindly, check out following link for more details on 2's complement: http://academic.evergreen.edu/projects/biophysics/technotes/program/2s_comp.htm Thanks, Yasir On Aug 7, 6:01 pm, Shashank Jain shashan...@gmail.com wrote: nd moreover after 2's complement its 0111 which is 7 nd not -7. so how? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sun, Aug 7, 2011 at 6:25 PM, Shashank Jain shashan...@gmail.com wrote: so tell me fr any bit representation, 1st bit is for sign only na? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sun, Aug 7, 2011 at 6:03 PM, Yasir yasir@gmail.com wrote: 8 bit was taken just for example. It can be 16/32 bit but that won't make any difference on leading 0's or 1's. On Aug 7, 5:28 pm, Shashank Jain shashan...@gmail.com wrote: y r we taking 8 bit numbers, i mean dat way we cant go beyond -127 to 127? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sun, Aug 7, 2011 at 5:39 PM, Yasir yasir@gmail.com wrote: let say a=6; binary= 0110 b = ~a = 1001 Now when you print value of ~a or b, it is calculating 2's complement. 1's complement: 0110 2's complement: 0111 (value = -7) Pls check signed bit representation for details. On Aug 7, 4:40 pm, Shashank Jain shashan...@gmail.com wrote: bitwise complement operator (~), complements d digits of d input bt when i use it : int a,b; b=~a; output: its giving o/p such that b= -a-1; why is dat so? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] A Nice Programming Challenge Question
Guys, Let's try to find out an efficient solution for the following prob: Given N numbers , [N=10^5] we need to count the total pairs of numbers that have a difference of K. [K0 and K1e9] Input Format: 1st line contains N K. 2nd line contains N numbers of the set. All the N numbers are assured to be distinct. Output Format: One integer saying the no of pairs of numbers that have a diff K. PS: Note that n is very large, so try to come up with an efficient solution. :) Source: http://www.interviewstreet.com/recruit/challenges/dashboard/ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: A Nice Programming Challenge Question
@Dave and Piyush. Thanks. Nice approach :) Is further optimization possible? (May be by increasing space complexity) On Aug 7, 11:09 pm, Piyush Kapoor pkjee2...@gmail.com wrote: First sort the array.Then for each element,say x ,do a binary search to find the element y for which (y-x)=K or y=(x+K),if the elements are not distinct then the number of pairs will be the upper_bound()-lower_bound() for y. Complexity:O(nlogn) On Sun, Aug 7, 2011 at 11:23 PM, Yasir yasir@gmail.com wrote: Guys, Let's try to find out an efficient solution for the following prob: Given N numbers , [N=10^5] we need to count the total pairs of numbers that have a difference of K. [K0 and K1e9] Input Format: 1st line contains N K. 2nd line contains N numbers of the set. All the N numbers are assured to be distinct. Output Format: One integer saying the no of pairs of numbers that have a diff K. PS: Note that n is very large, so try to come up with an efficient solution. :) Source:http://www.interviewstreet.com/recruit/challenges/dashboard/ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] A Nice Programming Challenge Question
@Shuaib, You are right, this approach will work! :) But for each element 'e' instead of checking whether *|K-e| *exists, *you should check for either (e+K) or (e-K).* But here the question is, will the hash map really give o(1) access for such a large record? ..and is it a good practice to create such large map while solving these kinda problem? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/bHxWTp3DLQgJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: amazon online test format
You can take out sample test at http://www.interviewstreet.com/recruit/test/start/sample Amazon uses same env for online coding test. On Aug 6, 5:55 pm, Atul Verma atul.iit...@gmail.com wrote: it's not like cc format. first they'll ask ur logic and then they see ur code. (no submission process) On Sat, Aug 6, 2011 at 5:45 PM, nivedita arora vivaciousnived...@gmail.comwrote: hi, can anyone pls tell whats the format of coding section in amazon online test. is it something like codechef ? is the format of test cases given ? Also, usually we write some part of code/function and test it if its running fine on local system , when it is then we submit at codechef. If it has codechef format then how does one do debugging in code?? no one ever writes whole code in one go and then runs it if its working fine . we always do it step by step .can that be done in amazon test ? if yes how? thanks! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: amazon online test format
Earlier they had telephonic interview as first round but now this online exam has become initial screening test. Based on ur online test's performance they call for phonic round or on- site interview. In online test, there there are 10 mcq questions and 5 coding probs. Cheers \o/ On Aug 6, 7:17 pm, Nitish Garg nitishgarg1...@gmail.com wrote: Can anyone shed some light on Amazon Off campus procedure? This online test is for off campus aspirants right? Also does this online test happen after the phonic interview? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: amazon online test format
Almost same. For big probs, they don't ask for running code. Only pseudo-code is enough. On Aug 6, 9:42 pm, Ankur Garg ankurga...@gmail.com wrote: The questions in the link are quite decent...Is the toughness level of Amazon test same or more ? On Sat, Aug 6, 2011 at 11:47 AM, shady sinv...@gmail.com wrote: @nivedita this is for job right ? On Sat, Aug 6, 2011 at 9:14 PM, nivedita arora vivaciousnived...@gmail.com wrote: no online test is happening on campus for us On Aug 6, 7:17 pm, Nitish Garg nitishgarg1...@gmail.com wrote: Can anyone shed some light on Amazon Off campus procedure? This online test is for off campus aspirants right? Also does this online test happen after the phonic interview? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: amazon online test format
Same as of DS Algo in GATE exam. http://geeksforgeeks.org/?cat=66 On Aug 7, 2:29 am, Ankur Garg ankurga...@gmail.com wrote: @Yasir MCQ are of which types ??? Regards Ankur Garg On Sat, Aug 6, 2011 at 4:45 PM, Yasir yasir@gmail.com wrote: Earlier they had telephonic interview as first round but now this online exam has become initial screening test. Based on ur online test's performance they call for phonic round or on- site interview. In online test, there there are 10 mcq questions and 5 coding probs. Cheers \o/ On Aug 6, 7:17 pm, Nitish Garg nitishgarg1...@gmail.com wrote: Can anyone shed some light on Amazon Off campus procedure? This online test is for off campus aspirants right? Also does this online test happen after the phonic interview? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.