Tesla Coding & Algorithms Interview Questions
Practice the exact questions companies are asking right now.
Implement 2D convolution forward pass
Problem Implement the forward pass of a 2D convolution (conv2d) from scratch (no deep learning libraries). You are given: - Input tensor x with shape ...
Verify permutation in-place and implement fast power
1) Given an integer list A of length n, determine whether A is a permutation of [0, 1, ..., n-1]. Do it in-place with O( 1) extra space (no auxiliary ...
Calculate trapped water between elevation bars
Given an array of non-negative integers representing the heights of unit-width vertical bars, compute the total water retained after rainfall. Start b...
Implement automatic braking logic in Python
Using Python, implement a simple automatic braking function. Given current speed v (m/s), distance to obstacle d (m), maximum deceleration a_max (m/s^...
Design a contiguous segment allocator
Design an in-memory contiguous segment allocator over an array of n cells (indexed 0..n- 1), all initially free. Support two operations: 1) allocate(l...
Solve classic array, graph, and parsing problems
Implement and analyze solutions to the following independent tasks: 1) Expression evaluator: Given a string s of digits, '+', '-', '*', '/', and space...
Optimize Trapping Rain Water
Question LeetCode 42. Trapping Rain Water – implement a brute-force solution, analyze its complexity, then optimize to an O(n) solution with O(n) spac...
Find latency pairs with minimal difference
Given an array of integers representing network latencies, return all increasing pairs [a, b] such that b − a equals the minimal absolute difference b...