Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. 1. Given a NxN matrix which contains all distinct 1 to n^2 numbers, write code to print sequence of increasing adjacent sequential numbers. 
  2. ex: 
  3. 1 5 9 
  4. 2 3 8 
  5. 4 6 7 
  6.  
  7. should print 
  8. 6 7 8 9
  9.  
  10. From <http://www.careercup.com/question?id=5147801809846272>
  11.  
  12.  
  13.  
  14. 1. Given a string (for example: "a?bc?def?g"), write a program to generate all the possible strings by replacing ? with 0 and 1. 
  15. Example: 
  16. Input : a?b?c? 
  17. Output: a0b0c0, a0b0c1, a0b1c0, a0b1c1, a1b0c0, a1b0c1, a1b1c0, a1b1c1.
  18.  
  19. From <http://www.careercup.com/question?id=5192571630387200>
  20.  
  21.  
  22. Traveler wants to travel from city “A” to city “D”. 
  23. There is a path from city “A” to city “D”. 
  24. Path consists of steps, i.e. travel from city “A” to city “B”. 
  25. Path is encoded as sequence of steps. 
  26. Sequence is in incorrect order. 
  27. Your task is to restore order of steps in the path. 
  28. Input (unordered sequence): 
  29. C -> D 
  30. A -> B 
  31. B -> C 
  32. Output (Correctly ordered list which represents path): 
  33. A, B, C, D 
  34.  
  35. From <http://www.careercup.com/question?id=5749537700315136>
  36.  
  37.  
  38.  
  39. Given a Binary Search tree of integers, you need to return the number of nodes having values between two given integers. You can assume that you already have some extra information at each node (number of children in left and right subtrees !!).
  40.  
  41. From <http://www.careercup.com/question?id=5165570324430848>
  42.  
  43.  
  44.  
  45. You are given information about hotels in a country/city. X and Y coordinates of each hotel are known. You need to suggest the list of nearest hotels to a user who is querying from a particular point (X and Y coordinates of the user are given). Distance is calculated as the straight line distance between the user and the hotel coordinates.
  46.  
  47. From <http://www.careercup.com/question?id=5634947435986944>
  48.  
  49.  
  50. Look for 2D tree algorithm
  51.  
  52. Given a complete binary tree, print the outline of the tree in anti-clockwise direction, starting from the root. I.e. first print all the nodes on the left 
  53. edge of the tree going downwards, then print all the leaves going left to right (including leaves on both the last and the 2nd last level if necessary), then 
  54. print the nodes on the right edge of the tree going upwards. 
  55.  
  56. Example tree: 
  57. / \ 
  58. / \ 
  59. B C 
  60. / \ / \ 
  61. D E F G 
  62. / \ / 
  63. H I J 
  64.  
  65. Expected Output: ABDHIJFGC
  66.  
  67. From <http://www.careercup.com/question?id=5924407818059776>
  68.  
  69. Design a two player battleship game to be played over internet
  70.  
  71. From <http://www.careercup.com/question?id=5644457835757568>
  72.  
  73.  
  74.  
  75. Suppose you have a million integer numbers. 
  76. Return all possible values of a,b and c such that 
  77. a+b+c<=d. 
  78. d will be provided to you. 
  79. ex: if the numbers are 1,2,3,4,5,6,7 
  80. and d=7 
  81. [1,2,3] 
  82. [1,2,4] 
  83.  
  84. [1,2,3] will be same as [1,3,2] and [3,2,1]... 
  85.  
  86. follow up: 
  87.  
  88. Return all such parts that satisfy the above condition if d is not provided.
  89.  
  90. From <http://www.careercup.com/question?id=5744225618493440>
  91.  
  92.  
  93.  
  94. Given a string with multiple spaces write a function to in-place trim all spaces leaving a single space between words 
  95. e.g. 
  96. _ _ _ Hello _ _ _ World _ _ _ 
  97. Hello _ World _ _ _ _ _ _ _ _ _
  98.  
  99. From <http://www.careercup.com/question?id=5178446623801344>
  100.  
  101. How many occurrences of a given search word can you find in a two-dimensional array of characters given that the word can go up, down, left, right, and around 90 degree bends? 
  102.  
  103. Ex: 
  104. Count of occurrences of SNAKES 
  105. S N B S N 
  106. B A K E A 
  107. B K B B K 
  108. S E B S E 
  109.  
  110. The answer is 3. 
  111.  
  112.  
  113.  
  114. Write a program for that question.
  115.  
  116. From <http://www.careercup.com/question?id=5709186067333120>
  117.  
  118.  
  119. Find minimum number of steps to reach the end of array from start (array value shows how much you can move).
  120.  
  121. From <http://www.careercup.com/question?id=5677781199355904>
  122.  
  123.  
  124.  
  125. Determine minimum sequence of adjacent values in the input parameter array that is greater than input parameter sum. 
  126.  
  127. Eg 
  128. Array 2,1,1,4,3,6. and Sum is 8 
  129. Answer is 2, because 3,6 is minimum sequence greater than 8.
  130.  
  131. From <http://www.careercup.com/question?id=5653018213089280>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement