L&T (Larsen & Toubro) Interview Preparation

55+ system design, OOP, engineering domain and coding questions with solutions.

QuestionAnswerCategory
Q1. Design a parking lot system.Multiple levels, vehicle types, spot allocation, payment processing. Use state machine for spot status.System Design
Q2. What is encapsulation?Bundling data and methods. Hide internal details using access modifiers. Use getters/setters for controlled access.Technical
Q3. Array rotation by k elements.Use reverse technique or slicing. O(n) time, O(1) space.
def rotate(arr, k):
    k = k % len(arr)
    arr[:] = arr[-k:] + arr[:-k]
Coding
Q4. Inheritance vs Composition.Inheritance: "is-a" relationship. Composition: "has-a" relationship. Composition more flexible.Technical
Q5. Design elevator system.Multiple elevators, scheduling algorithm, floor requests, capacity management, emergency scenarios.System Design
Q6. Explain IoT in manufacturing.Sensors in machines monitor performance, predict maintenance, optimize production, reduce downtime.Technical
Q7. Trap rainwater problem.Water = min(max_left, max_right) - height. Use two pointers or DP.
def trap(height):
    if not height: return 0
    left, right = 0, len(height)-1
    max_left = max_right = water = 0
    while left < right:
        if height[left] < height[right]:
            max_left = max(max_left, height[left])
            water += max_left - height[left]
            left += 1
        else:
            max_right = max(max_right, height[right])
            water += max_right - height[right]
            right -= 1
    return water
Coding
Q8. Longest increasing subsequence.DP: dp[i] = length of LIS ending at i. Binary search approach O(n log n).Coding
Q9. Design ATM machine.Card reader, PIN verification, account access, cash dispensing, transaction logging, security measures.System Design
Q10. Maximum rectangular area in histogram.Use stack to track bars. Calculate area for each bar as potential height.Coding
Q11. Polymorphism types.Compile-time: method overloading. Runtime: method overriding. Achieves flexibility.Technical
Q12. Merge k sorted lists.Use min heap (priority queue). O(n log k) time.
import heapq
def mergeKLists(lists):
    heap = [(head.val, i, head) for i, head in enumerate(lists) if head]
    heapq.heapify(heap)
    dummy = Node(0)
    curr = dummy
    while heap:
        val, i, node = heapq.heappop(heap)
        curr.next = node
        curr = curr.next
        if node.next:
            heapq.heappush(heap, (node.next.val, i, node.next))
    return dummy.next
Coding
Q13. Real-time systems in L&T projects.Systems requiring deterministic response times. Used in automation, robotics, control systems.Technical
Q14. Word ladder shortest path.BFS: start word, generate next words by changing one letter, find shortest path.Coding
Q15. Design library management system.User management, catalog, borrowing/returning, fine calculation, reservation system.System Design
Q16. Serialize/deserialize binary tree.Preorder traversal with null markers. Reconstruct via reverse process.Coding
Q17. Palindrome partitions.Backtracking: partition string, check palindromes, collect valid partitions.Coding
Q18. Abstract class design principles.Define interface, hide implementation. Use template method pattern for common behavior.Technical
Q19. Minimum path sum in grid.DP: dp[i][j] = min cost path to (i,j) from (0,0).Coding
Q20. Microservices vs monolithic architecture.Microservices: independent, scalable, complex deployment. Monolithic: simpler, tight coupling.Technical
Q21. Count inversions in array.Merge sort approach. O(n log n) time. Count pairs where i < j but arr[i] > arr[j].Coding
Q22. SOLID principles.Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion.Technical
Q23. Sliding window maximum.Deque to maintain indices of useful elements in decreasing order.Coding
Q24. Design vending machine.Product selection, payment processing, inventory management, change return, error handling.System Design
Q25. Regular expression matching.DP with pattern matching rules: . matches any, * matches 0+ of previous.Coding
Q26. Wildcard pattern matching.* matches any sequence, ? matches any single char. DP approach.Coding
Q27. Factory pattern.Creational pattern. Factory method creates objects without specifying exact classes.Technical
Q28. Distinct subsequences.DP: count distinct subsequences of string matching pattern.Coding
Q29. Matrix chain multiplication.DP: find minimum multiplications needed. dp[i][j] = min cost to multiply matrices i to j.Coding
Q30. Design stock trading system.Order matching, price tracking, portfolio management, risk management, settlement.System Design
Q31. Tell me about yourself.Education, projects, skills relevant to L&T (engineering domain), why interested in L&T.HR
Q32. Why L&T?Reputation, engineering excellence, global presence, infrastructure projects, innovation.HR
Q33. Strengths.Problem-solving, system thinking, quick learner, analytical, collaborative.HR
Q34. Handling pressure.Prioritize, break problems into smaller tasks, communicate, stay solution-focused.HR
Q35. Team experience.STAR method: project collaboration, roles, communication, results.HR
Q36. Burst balloons.DP with interval DP approach. dp[left][right] = max coins bursting balloons between.Coding
Q37. Remove duplicate letters.Greedy with stack: maintain lexicographically smallest subsequence.Coding
Q38. Smallest subarray sum.Sliding window: find minimum length subarray with sum >= target.Coding
Q39. Maximum rectangle in matrix.Convert to histogram problem for each row, apply max rectangle algorithm.Coding
Q40. Expression add operators.Backtracking: place +, -, * operators, evaluate expressions, find all that equal target.Coding
Q41. Salary expectations.Research L&T salary range. Give realistic range with flexibility.HR
Q42. Career goals.Senior engineer, project lead, technical expertise in systems/infrastructure.HR
Q43. Median finder - data stream.Use two heaps: max heap for smaller half, min heap for larger half.Coding
Q44. Largest rectangle in skyline.Stack-based approach. Calculate area for each building.Coding
Q45. Alien dictionary order.Topological sort: build graph from words, perform DFS to get order.Coding
Q46. CAD/CAM in manufacturing.Computer-Aided Design and Manufacturing. Improves precision, efficiency, product quality.Technical
Q47. Graph coloring problem.Check if graph can be colored with k colors such that no adjacent nodes have same color.Coding
Q48. Cutting stick problem.DP: minimize cost of cutting stick at given positions.Coding
Q49. How do you learn new technologies?Courses, documentation, projects, GitHub, technical blogs, conferences.HR
Q50. Any questions for us?Ask about projects, team, tech stack, growth, mentoring, engineering challenges.HR
Q51. Super ugly number.DP with priority queue: generate numbers as products of primes in sorted order.Coding
Q52. Rectangle area.Coordinate compression + area calculation for overlapping rectangles.Coding
Q53. Maximal rectangle with 1s.Convert to histogram problem for each row.Coding
Q54. Reverse pairs.Merge sort based counting. Count pairs where i < j but arr[i] > 2*arr[j].Coding
Q55. Describe challenging problem solved.Technical problem: approach, solution, learning, impact.HR