leetcode
文章平均质量分 53
芝麻香儿
一只行走在AI路上的小菜鸟~~~
展开
-
3. Longest Substring Without Repeating Characters最长子串
3. Longest Substring Without Repeating Characters最长子串 难度:Medium 问题描述:Given a string s, find the length of the longest substring without repeating characters. Example 1: input: s = “abcabcbb” Output: 3 Explanation: The answer is “abc”, with the length of 3原创 2021-02-23 23:17:04 · 259 阅读 · 0 评论 -
Leetcode 104. Maximum Depth of Binary Tree
104. Maximum Depth of Binary Tree 难度:easy 问题描述:Given the root of a binary tree, return its maximum depth. A binary tree’s maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 找到树的最大层数 解法1 思路:递归,利用深度原创 2020-12-24 16:40:31 · 405 阅读 · 2 评论 -
leetcode 101. Symmetric Tree
101. Symmetric Tree 难度:easy 问题描述:对称树 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the following [1原创 2020-12-23 16:34:34 · 289 阅读 · 0 评论 -
100. Same Tree
leetcode 100. Same Tree 难度:easy 描述: Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. 解法1 思路:原创 2020-12-23 16:28:25 · 73 阅读 · 0 评论 -
Leetcode 88. Merge Sorted Array
88. Merge Sorted Array 问题描述: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. 说白了就是数组有序合并。 Note: The number of elements initialized in nums1 and nums2 are m and n respectively. You may assume that nums1 has enoug原创 2020-12-15 11:46:33 · 76 阅读 · 0 评论 -
leetcode 83. Remove Duplicates from Sorted List
83. Remove Duplicates from Sorted List 难度:easy 问题描述: Given a sorted linked list, delete all duplicates such that each element appear only once. 中文:移除重复的节点 Example 1: Input: 1->1->2 Output: 1->2 Example 2: Input: 1->1->2->3->3 Output原创 2020-12-11 15:49:22 · 70 阅读 · 0 评论 -
70. Climbing Stairs leetcode 爬楼梯
70. Climbing Stairs 问题表述: You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 思路:这是道Fibonacci问题,当n>=2时,F(N) = F(N-1)+F(N-2),有些区别是,斐波那契序列是从0开始,即原创 2020-12-11 14:59:21 · 106 阅读 · 0 评论 -
69. Sqrt(x)leetcode
@[TOC](69. Sqrt(x)leetcode) #69. Sqrt(x) 问题描述:Given a non-negative integer x, compute and return the square root of x. Since the return type is an integer, the decimal digits are truncated, and only the integer part of the result is returned. Example 1: I原创 2020-12-10 16:51:21 · 114 阅读 · 0 评论 -
67. Add Binary 二进制加法leetcode
67 Add Binary 二进制加法leetcode题目描述方法1:方法2: 题目描述 Given two binary strings a and b, return their sum as a binary string. 中文:给定两个二进制的字符串,计算他们的加法和,结果以字符串返回 知识点: 1.字符转数字:该字符 - ‘0’ 2.二进制加法 3.进位处理 方法1: 思路:将短字符串前面补零,从后往前对应相加, 二进制加法: 1+1=10,1+1+1=11 十进制加法: 结果有四种情况:0原创 2020-12-07 23:10:09 · 134 阅读 · 0 评论 -
66. Plus One 加一 LeetCode
66. Plus One 加一 LeetCode66. Plus One 加一 LeetCode 66. Plus One 加一 LeetCode 难度:easy 问题描述: Given a non-empty array of decimal digits representing a non-negative integer, increment one to the integer. The digits are stored such that the most significant digit原创 2020-11-22 22:39:26 · 103 阅读 · 0 评论 -
58. Length of Last Word最后一个字符串的长度Leetcode
#58. Length of Last Word最后一个字符串的长度 问题描述: 难度:easy Given a string s consists of some words separated by spaces, return the length of the last word in the string. If the last word does not exist, return 0. A word is a maximal substring consisting of non-spa原创 2020-11-20 14:02:22 · 93 阅读 · 0 评论 -
66. Maximum Subarray 最大子序列和leetcode
Maximum Subarray 最大子序列和问题描述 问题描述 '难度:easy' Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Follow up: If you have figured out the O(n) solution, try coding another sol原创 2020-11-19 16:57:14 · 83 阅读 · 0 评论