![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCod 算法进阶
hengliwuyou
这个作者很懒,什么都没留下…
展开
-
四数 之和
题目:给你一个由 n 个整数组成的数组nums ,和一个目标值 target 。请你找出并返回满足下述全部条件且不重复的四元组[nums[a], nums[b], nums[c], nums[d]](若两个四元组元素一一对应,则认为两个四元组重复):0 <= a, b, c, d< na、b、c 和 d 互不相同nums[a] + nums[b] + nums[c] + nums[d] == target你可以按 任意顺序 返回答案 。示例 1:输入:nums = ...原创 2021-12-20 16:47:23 · 165 阅读 · 0 评论 -
最长公共前缀
1.题目编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串""。示例 1:输入:strs = ["flower","flow","flight"]输出:"fl"示例 2:输入:strs = ["dog","racecar","car"]输出:""2.代码 public String longestCommonPrefix(String[] strs) { //一个字符串,则直接返回 if(strs.leng.原创 2021-12-13 21:22:02 · 175 阅读 · 0 评论 -
Nim Game
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the原创 2015-10-16 14:25:53 · 292 阅读 · 0 评论 -
Word Pattern
Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.Exampl原创 2015-10-16 22:30:45 · 343 阅读 · 0 评论 -
Move Zeroes
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling you原创 2015-10-19 22:36:12 · 311 阅读 · 0 评论 -
First Bad Version
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the原创 2015-10-20 21:27:35 · 252 阅读 · 0 评论