Leetcode Algo Day1

704. Binary Search

Time: 11min

Method: binary search

Reflection: need to break from while look when the target is found

Time complexity: O(logN)

Space Complexity: O(1) 

27. Remove Element

Time: 10min

Method: brute force

Reflection: index boundary; while vs for loop

Time complexity: O(N^2)

Space complexity: O(1) 

Time: 10min

Method: two pointers - fast vs slow

Reflection: left pointers record the correct elements. since left pointer always slower than right pointer, they can be swapped in place.

Time complexity: O(N)

Space complexity: O(1)

相关推荐

  1. nvm1.1.11

    2024-03-10 23:54:06       50 阅读
  2. 1.下午试题1

    2024-03-10 23:54:06       29 阅读
  3. HTML-1

    2024-03-10 23:54:06       57 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-10 23:54:06       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-10 23:54:06       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-10 23:54:06       82 阅读
  4. Python语言-面向对象

    2024-03-10 23:54:06       91 阅读

热门阅读

  1. uniapp——信号值组件(vue3)

    2024-03-10 23:54:06       41 阅读
  2. React-Context机制

    2024-03-10 23:54:06       39 阅读
  3. websocket+心跳

    2024-03-10 23:54:06       47 阅读
  4. uniapp 开发app,如何使用模拟器

    2024-03-10 23:54:06       40 阅读
  5. linux系统安装docker

    2024-03-10 23:54:06       33 阅读
  6. CatBoost高级教程:分布式训练与大规模数据处理

    2024-03-10 23:54:06       38 阅读
  7. Linux运维_Bash脚本_编译安装Mesa-23.3.6(OpenGL)

    2024-03-10 23:54:06       32 阅读
  8. 从零开始 TensorRT(7)C++ 篇:解析 ONNX

    2024-03-10 23:54:06       44 阅读