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.'
    +13

    " 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
  • Tesla logoAsked at Tesla 
    Video answer for 'Generate Parentheses'
    +6

    " O(n) time from typing import List def generate_parentheses(n: int): res = [] def generate(buf, opened, closed): if len(buf) == 2 * n: if n != 0: res.append(buf) return if opened < n: generate( buf + "(", opened + 1, closed) if closed < opened: generate(buf + ")", opened, closed + 1) generate("", 0, 0) return res debug your code below print(generate_parentheses(1"

    Rick E. - " O(n) time from typing import List def generate_parentheses(n: int): res = [] def generate(buf, opened, closed): if len(buf) == 2 * n: if n != 0: res.append(buf) return if opened < n: generate( buf + "(", opened + 1, closed) if closed < opened: generate(buf + ")", opened, closed + 1) generate("", 0, 0) return res debug your code below print(generate_parentheses(1"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
  • 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
    Data Structures & Algorithms
    +1 more
  • Tesla logoAsked at Tesla 
    +9

    "function trapRainWater(height) { if (height.length = leftTrap || leftPosition >= heightLimit) { leftTrap = leftPosition; heightLimit = Math.min(le"

    Tiago R. - "function trapRainWater(height) { if (height.length = leftTrap || leftPosition >= heightLimit) { leftTrap = leftPosition; heightLimit = Math.min(le"See full answer

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