← 回題庫

卷別

資料結構

選擇

國立中央大學 2026 · 考試 · 第 49 題

Given an array of integers and a target value, return the indices of the two numbers that add up to the target. What type of data structures allows to deduce a brute-force O(n2)O(n^2) solution down to O(n)O(n) time complexity.

  • (A)
    Array
  • (B)
    linked list
  • (C)
    Heap
  • (D)
    Hashing
  • (E)
    Tree

標準解析

AI 生成