Leetcode 问题和题目 - 最佳 50 个

本文讨论了在编程面试中掌握数据结构和算法的重要性,特别是在使用 Leetcode、HackerRank 等平台时,如何选择合适的入门题目。文章提供了针对数组、字符串和哈希表等基本数据结构的选题建议,强调应先熟悉基础逻辑和解决问题的能力,然后再逐步过渡到复杂算法。此外,文章还包含了一些实践问题的链接,以帮助开发者在编程面试中取得优势。

无论是 web2 还是 web3,良好的数据结构、算法和 Leetcode 问题的能力都很重要,不仅对找工作有帮助,还能为计算机科学打下良好的基础。

许多开发者知道他们应该练习 leetcode(或者替代性的 hackerrankcodecademycodewars),但如果你还没开始,可能会感到很不知所措。

你应该从哪些 Leetcode 问题开始,顺序应该如何呢?

克服开始时的心理障碍

没有什么比打开这些网站,随便选一个标记为简单的问题,然后陷入困境更让人沮丧的了。现在你必须花费三倍的精力:寻找合适的问题、解决它,并且不要自己怀疑是选择错了问题还是自己根本不适合这个测试。

我们建议从一些非常简单的 Leetcode 问题开始。真的,挑战一下这个怎么样?

<https://leetcode.com/problems/add-two-integers/>

func sum(num1 int, num2 int) int {

}

一个简单的编码问题,用于添加两个整数

听起来不太吓人,对吧?

专注于语言的核心

有很多数据结构和算法。存在树、链表、堆、队列、图、定向图等等!为了避免选择过多而感到不知所措,最好专注于几乎所有现代语言中内建的数据结构。

  • 数组
  • 字符串
  • 嵌套数组(二维数组)
  • 哈希表

大多数语言允许你在不引入任何东西的情况下使用这些数据结构。

如果要使用队列或堆等东西,你必须引入某种库。尽管技术看起来光鲜且“新颖”,但编程语言已经存在了数十年。它们已经演变得使常见操作变得简单。如果一种语言的使用需要更多的工作,它最终会失去受欢迎度。

镜像二叉树并不是一件常见的事情。但操作字符串和数组是非常常见的,因此它们被内置在语言中。

如果你不知道如何在一种语言中做这些基本的事情,你就不算会编程。如果不知道如何处理树、图和队列,那也是不特定于某门语言的。但如果你无法在 JavaScript 中遍历数组,那么你就不能说自己会 JavaScript。

我们编制的问题列表旨在确保你对语言的基础知识感到舒适。这些问题将为你以后的更高级主题奠定良好的基础。

首先关注逻辑和解决问题的能力

算法的名字可能看起来很吓人,通常是一些很少使用的欧洲名字的拼接,具有神秘的应用。Floyd-Warshall 算法?Dijkstra 算法?Fisher-Yates?

你可以等到稍后再学习这些。

但你绝对必须能够做一些基本的事情,这些事情甚至不是“算法性”的。

例如,给定一个井字棋网格,你能否判断游戏是否结束?你并不需要任何复杂的算法来做到这一点。如果你连这个基本任务都很难完成,你在面对上面列出的一些更高级的算法时,就会很困难。

我们在这里列出的问题不需要任何特殊的技巧来解决。在你添加更多的大学水平技术之前,先学会应用基本的逻辑和常识解决方案。

这些问题不会太简单吗?

也许你不是这个目标受众,但你会惊讶于有多少人自称为开发者却 无法解答 fizz buzz。我们亲身经历过这一点。当你申请我们的项目时,你会迅速收到一封包含编码测试链接的电子邮件。其中一个测试题就是 fizz buzz。而这个题目的失败率是 的。

也许是因为紧张,或者之前没有参加过 编码测试。但是如果你从未至少练习过一次编码测试,就不算对自己有利。

这对通过编码面试够用吗?

如果你能解决所有这些问题,你可能能找到一份工作!这将是一个非常入门级的工作,在那些不太挑剔的公司。但即使如此也是有可能的。

你不需要支付费用使用这些问题吗?

我们只包括免费版本中的问题。

版权声明
因为我们与其他软件培训程序发生了抄袭问题,这项作品的全部内容都受《创意共享非商业许可》授权。


热身 (播放列表)

  1. <https://leetcode.com/problems/convert-the-temperature/>
  2. <https://leetcode.com/problems/add-two-integers/>
  3. <https://leetcode.com/problems/smallest-even-multiple/>
  4. <https://leetcode.com/problems/final-value-of-variable-after-performing-operations/>
  5. <https://leetcode.com/problems/count-of-matches-in-tournament/>
  6. <https://leetcode.com/problems/number-of-common-factors/>
  7. <https://leetcode.com/problems/xor-operation-in-an-array/>

字符串 (播放列表):

  1. <https://leetcode.com/problems/length-of-last-word/>
  2. <https://leetcode.com/problems/to-lower-case/>
  3. <https://leetcode.com/problems/to-lower-case/>(反向进行
  4. <https://leetcode.com/problems/reverse-string/>(不要使用双指针
  5. <https://leetcode.com/problems/valid-palindrome/>
  6. <https://leetcode.com/problems/count-vowel-substrings-of-a-string/>(不要使用哈希表
  7. <https://leetcode.com/problems/repeated-substring-pattern/>
  8. <https://leetcode.com/problems/defanging-an-ip-address/>
  9. <https://leetcode.com/problems/determine-color-of-a-chessboard-square/>
  10. <https://leetcode.com/problems/add-digits/>
  11. <https://leetcode.com/problems/jewels-and-stones/>
  12. <https://leetcode.com/problems/roman-to-integer/>

数组 (播放列表):

  1. <https://leetcode.com/problems/fizz-buzz/>
  2. <https://leetcode.com/problems/check-if-array-is-sorted-and-rotated/>
  3. https://leetcode.com/problems/sort-an-array/(忽略 Leetcode 指令,使用内建特性)
  4. <https://leetcode.com/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence/>
  5. <https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/>
  6. <https://leetcode.com/problems/find-first-palindromic-string-in-the-array/>
  7. <https://leetcode.com/problems/running-sum-of-1d-array/>
  8. <https://leetcode.com/problems/merge-two-sorted-lists/>
  9. <https://leetcode.com/problems/find-greatest-common-divisor-of-array/>
  10. <https://leetcode.com/problems/maximum-number-of-words-found-in-sentences/>
  11. <https://leetcode.com/problems/final-value-of-variable-after-performing-operations/>
  12. <https://leetcode.com/problems/shuffle-the-array/>
  13. <https://leetcode.com/problems/shuffle-string/>
  14. <https://leetcode.com/problems/cells-in-a-range-on-an-excel-sheet/>
  15. <https://leetcode.com/problems/minimum-sum-of-four-digit-number-after-splitting-digits/>
  16. <https://leetcode.com/problems/decompress-run-length-encoded-list/>

2D 数组 (播放列表):

  1. <https://leetcode.com/problems/richest-customer-wealth/>
  2. <https://leetcode.com/problems/flipping-an-image/>
  3. <https://leetcode.com/problems/lucky-numbers-in-a-matrix/>
  4. <https://leetcode.com/problems/shift-2d-grid/>
  5. <https://leetcode.com/problems/available-captures-for-rook/>

哈希表 (播放列表):

  1. <https://leetcode.com/problems/jewels-and-stones/>
  2. <https://leetcode.com/problems/decode-the-message/>
  3. <https://leetcode.com/problems/unique-morse-code-words/>
  4. <https://leetcode.com/problems/check-if-the-sentence-is-pangram/>
  5. <https://leetcode.com/problems/first-letter-to-appear-twice/>
  6. <https://leetcode.com/problems/sum-of-unique-elements/>
  7. <https://leetcode.com/problems/merge-similar-items/>
  8. <https://leetcode.com/problems/divide-array-into-equal-pairs/>
  9. <https://leetcode.com/problems/destination-city/>
  10. <https://leetcode.com/problems/number-of-good-pairs>

喜欢这里的内容吗?查看我们的 免费 Solidity 课程

最初发布日期:2022 年 12 月 8 日

  • 原文链接: rareskills.io/post/best-...
  • 登链社区 AI 助手,为大家转译优秀英文文章,如有翻译不通的地方,还请包涵~
点赞 0
收藏 0
分享
本文参与登链社区写作激励计划 ,好文好收益,欢迎正在阅读的你也加入。

0 条评论

请先 登录 后评论
RareSkills
RareSkills
https://www.rareskills.io/