Wipro National Talent Hunt (NTH) Interview

55+ data structures, algorithms, trees/graphs questions with complete solutions.

QuestionAnswerCategory
Q1. Binary tree traversal: Inorder.Left-Root-Right. Sorted order for BST.
def inorder(root):
    result = []
    def traverse(node):
        if node:
            traverse(node.left)
            result.append(node.val)
            traverse(node.right)
    traverse(root)
    return result
Coding
Q2. BFS vs DFS.BFS: level-by-level, queue-based. DFS: depth-first, stack/recursion-based.Technical
Q3. Merge sort.Divide array in half, recursively sort, merge. O(n log n) always.Coding
Q4. Binary Search Tree properties.Left < Root < Right. O(log n) search if balanced.Technical
Q5. Quick sort.Choose pivot, partition around it. O(n log n) avg, O(n²) worst.
def quicksort(arr, low, high):
    if low < high:
        pi = partition(arr, low, high)
        quicksort(arr, low, pi-1)
        quicksort(arr, pi+1, high)
    return arr
Coding
Q6. Dijkstra algorithm.Shortest path from single source. Uses priority queue.Coding
Q7. LCA (Lowest Common Ancestor).Recursively search subtrees. Return node if found in both.Coding
Q8. Coin change.DP: dp[i] = min coins for amount i. O(n*amount) time.
def coinChange(coins, amount):
    dp = [float('inf')] * (amount + 1)
    dp[0] = 0
    for i in range(1, amount + 1):
        for coin in coins:
            if coin <= i:
                dp[i] = min(dp[i], dp[i - coin] + 1)
    return dp[amount]
Coding
Q9. Serialize/deserialize tree.Preorder with null markers. Reconstruct by reversing.Coding
Q10. Detect cycle in graph.DFS with visited/recursion stack. Or union-find for undirected.Coding
Q11. Heap sort.Build max heap, extract root repeatedly. O(n log n).Coding
Q12. Level order traversal.BFS: process level by level. Queue-based approach.
def levelOrder(root):
    if not root:
        return []
    result = []
    queue = [root]
    while queue:
        level = []
        for _ in range(len(queue)):
            node = queue.pop(0)
            level.append(node.val)
            if node.left:
                queue.append(node.left)
            if node.right:
                queue.append(node.right)
        result.append(level)
    return result
Coding
Q13. Longest Common Subsequence.DP: dp[i][j] = LCS length of s1[:i] and s2[:j].Coding
Q14. Topological sort.Kahn algorithm or DFS. Order nodes such that edges go left to right.Coding
Q15. Maximum path sum in tree.DFS: track max at each node including parent connection.Coding
Q16. Three way partitioning.Dutch flag problem: partition array into <, =, > sections.Coding
Q17. Balanced BST check.Check if height difference ≤ 1 for all nodes.Coding
Q18. Strongly connected components.Tarjan or Kosaraju algorithm. Find maximal subsets where all reachable.Coding
Q19. Counting sort.For range [0, k]. O(n+k) time, O(k) space.Coding
Q20. Mirror/reflect tree.Swap left and right children recursively.
def invertTree(root):
    if not root:
        return None
    root.left, root.right = root.right, root.left
    invertTree(root.left)
    invertTree(root.right)
    return root
Coding
Q21. Edit distance.DP: minimum operations to convert s1 to s2 (insert, delete, replace).Coding
Q22. Floyd-Warshall algorithm.All-pairs shortest paths. O(V³) time, works with negative edges.Coding
Q23. Trie implementation.Prefix tree: insert, search, startsWith operations.Coding
Q24. Radix sort.Sort by digit positions. O(d*n) for d-digit numbers.Coding
Q25. Validate BST.Inorder traversal should be sorted. Or recursive bounds checking.Coding
Q26. Bipartite graph check.2-color graph. BFS/DFS with 2 colors.Coding
Q27. Counting inversions.Merge sort approach. O(n log n) time.Coding
Q28. Sum of left leaves.DFS: sum nodes that are left children and leaves.Coding
Q29. Word break problem.DP: dp[i] = True if word[:i] can be segmented from dictionary.Coding
Q30. Minimum spanning tree.Kruskal or Prim algorithm. Connect all vertices with minimum weight.Coding
Q31. Tell me about yourself.Education, projects, internships, interests, why Wipro NTH.HR
Q32. Why Wipro?Innovation, global company, career growth, NTH program, technology.HR
Q33. Strengths.Problem-solving, communication, teamwork, adaptability, learning ability.HR
Q34. Bucket sort.Distribute into buckets, sort individually, concatenate. O(n+k) avg.Coding
Q35. Right view of tree.Last node at each level. Level order or DFS.Coding
Q35. Pancake sorting.Flip elements to sort. Interesting algorithm study.Coding
Q36. Graph coloring.Color graph with k colors such no adjacent have same color.Coding
Q37. Path from root to node.DFS: backtrack when path not matching.Coding
Q38. Matrix chain multiplication.DP: minimize scalar multiplications. dp[i][j] = min cost.Coding
Q39. Heap operations.Insert, delete-min (max), heapify. O(log n) operations.Coding
Q40. Vertical order traversal.Group nodes by column offset. Return groups top-to-bottom.Coding
Q41. Pressure handling.Prioritize, break into chunks, communicate, stay focused.HR
Q42. Salary expectations.Research sector. Realistic range with flexibility.HR
Q43. Flood fill algorithm.BFS/DFS: fill connected region with new color.Coding
Q44. Diameter of tree.Longest path between any two nodes. Two DFS approach.Coding
Q45. External sorting.Sorting data too large for RAM. Merge sorted blocks.Coding
Q46. Learning new tech.Courses, projects, documentation, hands-on practice.HR
Q47. Subtree of another tree.DFS: check if entire subtree structure matches.Coding
Q48. All paths in directed graph.DFS: backtrack and collect all source-to-destination paths.Coding
Q49. Longest increasing subsequence.DP or binary search. O(n log n) with binary search.Coding
Q50. Career goals in 5 years.Senior developer, technical lead, or specialist.HR
Q51. Populating next pointers.Connect each node to next node at same level.Coding
Q52. Alien dictionary.Topological sort: build order from word comparisons.Coding
Q53. Search in rotated sorted array.Binary search with rotation offset. O(log n).Coding
Q54. Boundary of binary tree.Left boundary + leaves + right boundary (reverse).Coding
Q55. Any questions?Ask about NTH program, projects, mentoring, tech stack, growth.HR