Capital One Coding Interview Questions

Review this list of 7 Capital One coding software engineer interview questions and answers verified by hiring managers and candidates.
  • Capital One logoAsked at Capital One 
    +28

    "Reversing a linked list is a very popular question. We have two approaches to reverse the linked list: Iterative approach and recursion approach. Iterative approach (JavaScript) function reverseLL(head){ if(head === null) return head; let prv = null; let next = null; let cur = head; while(cur){ next = cur.next; //backup cur.next = prv; prv = cur; cur = next; } head = prv; return head; } Recursion Approach (JS) function reverseLLByRecursion("

    Satyam S. - "Reversing a linked list is a very popular question. We have two approaches to reverse the linked list: Iterative approach and recursion approach. Iterative approach (JavaScript) function reverseLL(head){ if(head === null) return head; let prv = null; let next = null; let cur = head; while(cur){ next = cur.next; //backup cur.next = prv; prv = cur; cur = next; } head = prv; return head; } Recursion Approach (JS) function reverseLLByRecursion("See full answer

    Software Engineer
    Coding
    +4 more
  • "This was a 60 minute assessment. The clock is ticking and you're being observed by a senior+ level engineer. Be ready to perform for an audience. The implementation for the system gets broken up into three parts: Implement creating accounts and depositing money into an account by ID Implement transferring money with validation to ensure the accounts for the transfer both exist and that the account money is being removed from has enough money in it to perform the transfer Implement find"

    devopsjesus - "This was a 60 minute assessment. The clock is ticking and you're being observed by a senior+ level engineer. Be ready to perform for an audience. The implementation for the system gets broken up into three parts: Implement creating accounts and depositing money into an account by ID Implement transferring money with validation to ensure the accounts for the transfer both exist and that the account money is being removed from has enough money in it to perform the transfer Implement find"See full answer

    Software Engineer
    Coding
  • "C++ : vector justifywords(const vector& wordslist, int width) { vector result; string curr_line = ""; for (const string& word : words_list) { if (currline.length() + word.length() + (currline.empty() ? 0 : 1) > width) { result.pushback(currline); curr_line = ""; // Reset current line } if (!curr_line.empty()) { curr_line += " "; } curr_line += word; } if"

    Anonymous Basilisk - "C++ : vector justifywords(const vector& wordslist, int width) { vector result; string curr_line = ""; for (const string& word : words_list) { if (currline.length() + word.length() + (currline.empty() ? 0 : 1) > width) { result.pushback(currline); curr_line = ""; // Reset current line } if (!curr_line.empty()) { curr_line += " "; } curr_line += word; } if"See full answer

    Software Engineer
    Coding
  • "naive solution: def countprefixpairs(words): n = len(words) count = 0 for i in range(n): for j in range(i + 1, n): if words[i].startswith(words[j]) or words[j].startswith(words[i]): count += 1 return count using tries for when the list of words is very long: from collections import Counter class TrieNode: def init(self): self.children = {} self.count = 0 # To count the number of words ending at this node"

    Anonymous Unicorn - "naive solution: def countprefixpairs(words): n = len(words) count = 0 for i in range(n): for j in range(i + 1, n): if words[i].startswith(words[j]) or words[j].startswith(words[i]): count += 1 return count using tries for when the list of words is very long: from collections import Counter class TrieNode: def init(self): self.children = {} self.count = 0 # To count the number of words ending at this node"See full answer

    Software Engineer
    Coding
  • +9

    "from typing import List def maxprofitgreedy(stock_prices: List[int]) -> int: l=0 # buying r=1 # selling max_profit=0 while rstock_prices[l]: profit=stockprices[r]-stockprices[l] maxprofit=max(maxprofit,profit) else: l=r r+=1 return max_profit debug your code below print(maxprofitgreedy([7, 1, 5, 3, 6, 4])) `"

    Prajwal M. - "from typing import List def maxprofitgreedy(stock_prices: List[int]) -> int: l=0 # buying r=1 # selling max_profit=0 while rstock_prices[l]: profit=stockprices[r]-stockprices[l] maxprofit=max(maxprofit,profit) else: l=r r+=1 return max_profit debug your code below print(maxprofitgreedy([7, 1, 5, 3, 6, 4])) `"See full answer

    Software Engineer
    Coding
    +4 more
  • 🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.

  • Capital One logoAsked at Capital One 
    Software Engineer
    Coding
    +2 more
  • Capital One logoAsked at Capital One 
    Software Engineer
    Coding
    +4 more
Showing 1-7 of 7