Tesla Software Engineer Interview Questions

Review this list of 7 Tesla software engineer interview questions and answers verified by hiring managers and candidates.
  • Tesla logoAsked at Tesla 
    Video answer for 'Find a triplet in an array with a given sum.'
    +11

    " import java.util.*; class Solution { // Time Complexity: O(n^2) // Space Complexity: O(n) public static List> threeSum(int[] nums) { // Ensure that the array is sorted first Arrays.sort(nums); // Create the results list to return List> results = new ArrayList(); // Iterate over the length of nums for (int i = 0; i < nums.length-2; i++) { // We will have the first number in"

    Victor O. - " import java.util.*; class Solution { // Time Complexity: O(n^2) // Space Complexity: O(n) public static List> threeSum(int[] nums) { // Ensure that the array is sorted first Arrays.sort(nums); // Create the results list to return List> results = new ArrayList(); // Iterate over the length of nums for (int i = 0; i < nums.length-2; i++) { // We will have the first number in"See full answer

    Software Engineer
    Data Structures & Algorithms
    +3 more
  • "Clarifying questions: is this a brand new product, or are we improving an existing one? (i.e. are we going to have to migrate an existing codebase or are we starting from scratch?). are we resource-strapped (e.g. # engineers, time)? are there any specific priorities for the product, or should i leave it open-ended? Assume: brand new product, well-resourced, no specific priorities. It seems that there are two sides to this question: 1) technical evaluation of different languages, and 2)"

    Laura S. - "Clarifying questions: is this a brand new product, or are we improving an existing one? (i.e. are we going to have to migrate an existing codebase or are we starting from scratch?). are we resource-strapped (e.g. # engineers, time)? are there any specific priorities for the product, or should i leave it open-ended? Assume: brand new product, well-resourced, no specific priorities. It seems that there are two sides to this question: 1) technical evaluation of different languages, and 2)"See full answer

    Software Engineer
    Technical
  • Tesla logoAsked at Tesla 
    +1

    "def calc(expr): ans = eval(expr) return ans your code goes debug your code below print(calc("1 + 1")) `"

    Sarvesh G. - "def calc(expr): ans = eval(expr) return ans your code goes debug your code below print(calc("1 + 1")) `"See full answer

    Software Engineer
    Data Structures & Algorithms
    +3 more
  • Tesla logoAsked at Tesla 
    Video answer for 'Generate Parentheses'
    +5

    "function generateParentheses(n) { if (n < 1) { return []; } if (n === 1) { return ["()"]; } const combinations = new Set(); let previousCombinations = generateParentheses(n-1); for (let prev of previousCombinations) { for (let i=0; i < prev.length; i++) { combinations.add(prev.slice(0, i+1) + "()" + prev.slice(i+1)); } } return [...combinations]; } `"

    Tiago R. - "function generateParentheses(n) { if (n < 1) { return []; } if (n === 1) { return ["()"]; } const combinations = new Set(); let previousCombinations = generateParentheses(n-1); for (let prev of previousCombinations) { for (let i=0; i < prev.length; i++) { combinations.add(prev.slice(0, i+1) + "()" + prev.slice(i+1)); } } return [...combinations]; } `"See full answer

    Software Engineer
    Data Structures & Algorithms
    +3 more
  • Software Engineer
    Data Structures & Algorithms
    +3 more
  • 🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.

  • Tesla logoAsked at Tesla 
    Video answer for 'Find the minimum window substring.'

    "What about exploiting the hash set and that is it? def smallestSubstring(s: str, t: str) -> str: if len(t) > len(s): return "" r = len(s) - 1 not_found = True while r > 0 and not_found: subs_set = set(s[0:r + 1]) for c in t: if not c in subs_set: not_found = False if not_found: r -= 1 else: r += 1 l = 0 not_found = True while l < r and not_"

    Gabriele G. - "What about exploiting the hash set and that is it? def smallestSubstring(s: str, t: str) -> str: if len(t) > len(s): return "" r = len(s) - 1 not_found = True while r > 0 and not_found: subs_set = set(s[0:r + 1]) for c in t: if not c in subs_set: not_found = False if not_found: r -= 1 else: r += 1 l = 0 not_found = True while l < r and not_"See full answer

    Software Engineer
    Coding
    +1 more
  • Tesla logoAsked at Tesla 
    +7

    "from typing import List def traprainwater(height: List[int]) -> int: if not height: return 0 l, r = 0, len(height) - 1 leftMax, rightMax = height[l], height[r] res = 0 while l < r: if leftMax < rightMax: l += 1 leftMax = max(leftMax, height[l]) res += leftMax - height[l] else: r -= 1 rightMax = max(rightMax, height[r]) "

    Anonymous Roadrunner - "from typing import List def traprainwater(height: List[int]) -> int: if not height: return 0 l, r = 0, len(height) - 1 leftMax, rightMax = height[l], height[r] res = 0 while l < r: if leftMax < rightMax: l += 1 leftMax = max(leftMax, height[l]) res += leftMax - height[l] else: r -= 1 rightMax = max(rightMax, height[r]) "See full answer

    Software Engineer
    Data Structures & Algorithms
    +4 more
Showing 1-7 of 7