自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 Leetcode - String - Easy(14,28,58,125,344,383,387)

Longest Common Prefix以第一个元素为基准值,挨个与其它元素进行比较。while 循环里面就是为了使基准值成为比较元素的起始字符串,故它不满足就每次截掉最后一位。若是全部截完了那就是无公共前缀了。class Solution { public String longestCommonPrefix(String[] strs) { if(strs.length==0){return "";} String s = strs[0]; .

2021-02-06 09:43:17 100

原创 Leetcode - Array -Easy (26,27,53,88,118,121,167,169,217,219,228,268,283)

Remove Duplicates from Sorted ArrayGiven a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length.Do not allocate extra space for another array, you must do this by modifying the input array.

2021-01-20 09:15:49 103

原创 Leetcode -Math - Easy(7,9,13,50,66,67,69,204)

Reverse IntegerGiven a 32-bit signed integer, reverse digits of an integer.Note:Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: −2^31 ~ 2^31 − 1. For the purpose of this problem, assume t.

2021-01-12 05:29:12 188

原创 Leetcode - Hash table - Easy (1,202)

虽然题目是从Hash Table tag里搜出来的,但用HashMap/HashSet只是解法之一,有些题目的奇技淫巧还需看其他解法,我尽量整理在一起。Two SumGiven an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that each input would have exactl

2021-01-08 06:39:25 91

原创 Leetcode-Stack-Easy(20, 155, 225, 232)

Valid ParenthesesGiven a string s containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.对string遍历,左括号压栈,右括号检测栈不为空,且pop出来的是配对的符号,否则无效return false//1 ms,37.2 MBclass Solution1 { public boolean isVali.

2021-01-06 06:04:58 108

原创 Leetcode - Tree - Easy(111-404)

Minimum Depth of Binary TreeThe minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node./** * DFS思路,代码比较简洁,但如果是左侧500个单链孩子,右侧1个孩子这种比较极端的情况,时间复杂度会太高 * /class Solution1 { public int minDepth(Tre.

2021-01-05 02:28:10 87

原创 Leetcode - Tree - Easy(100-110)

Same TreeGiven the roots of two binary trees p and q, write a function to check if they are the same or not./** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNod.

2020-12-31 05:26:29 181

原创 Leetcode-linkedlist-easy (141,237,83,160,203,206,207,234)

Linked List CycleGiven head, the head of a linked list, determine if the linked list has a cycle in it.There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, .

2020-12-29 11:08:33 105

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除