leetcode
AI让世界更懂你
计算机科学与技术专业博士,主要研究方向为人工智能、自然语言处理、大规模语言模型和对话系统等。曾与微软小冰、微软小娜共同工作。兴趣广泛,包括并不限于人工智能,心理学,认知科学,语言学,数学,天文学等。让我们一起和AI,改进世界!
展开
-
leetcode(1):TwoSum
从今天开始我们开始踏上leetcode这片新的土地!从征服第一块领地开始!1.leetcode#1. Two Sum1.1题目描述Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume tha...原创 2018-03-03 21:59:19 · 421 阅读 · 0 评论 -
leetcode(2):3sum
在上一讲中,我们讲解了2个数之和的问题,这一次,我们讲解3个数之和的问题。1. leetcode#15. 3Sum1.1问题描述 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the ar...原创 2018-03-04 17:31:53 · 365 阅读 · 0 评论 -
leetcode(3):add
在这一讲中,我们主要讲解关于加法的相关题目。1.leetcode#2Add Two Numbers1.1题目描述 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of...原创 2018-03-05 20:48:10 · 287 阅读 · 0 评论 -
leetcode(4):substring
今天我们来讲字符子串的问题。1.leetcode#3. Longest Substring Without Repeating Characters1.1问题描述 Given a string, find the length of the longest substring without repeating characters.Examples: Given...原创 2018-03-06 20:48:05 · 606 阅读 · 0 评论 -
leetcode(5): two array
1.leetcode#4. Median of Two Sorted Arrays1.1问题描述 here are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time comple...原创 2018-03-12 10:47:44 · 326 阅读 · 0 评论 -
leetcode(6): easy
今天,我们主要讲几个简单的题目供大家休息。1.leetcode#20. Valid Parentheses1.1问题描述 Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. The b...原创 2018-03-14 23:21:36 · 283 阅读 · 0 评论 -
leetcode(7): easy2
今天我们接着讲简单题1.leetcode#136. Single Number1.1题目描述 iven an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runt...原创 2018-03-15 10:26:06 · 369 阅读 · 0 评论 -
leetcode(8):easy3
渐渐的发现,即使是简单题,也并不简单。每当发现一些奇妙的解法时,总是能够新奇不已。1.leetcode#169. Majority Element1.1问题描述 Given an array of size n, find the majority element. The majority element is the element that appears more than...原创 2018-03-17 09:03:51 · 317 阅读 · 0 评论 -
leetcode(9):tree
这里我们介绍几个关于树的问题。1.leetcode#226. Invert Binary Tree1.1问题描述 Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 ...原创 2018-03-17 09:44:05 · 320 阅读 · 0 评论 -
leetcode(10):easy4
这是我们100道题目中最后的easy题目了。1.leetcode#437. Path Sum III1.1问题描述 You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. ...原创 2018-03-17 10:35:02 · 327 阅读 · 0 评论 -
leetcode(11):midium1
这次我们进入到中级的水平的题目。1leetcode#5. Longest Palindromic Substring1.1题目描述 Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:...原创 2018-03-20 15:37:45 · 306 阅读 · 0 评论 -
leetcode(12):34. Search for a Range
1.34. Search for a Range1.1题目描述 Given an array of integers sorted in ascending order, find the starting and ending position of a given target value. 给定一个已经升序排序的整形数组,找出给定目标值的开始位置和结束位置。 Your...原创 2018-04-07 11:44:37 · 304 阅读 · 0 评论 -
leetcode(13):38. Count and Say
1.38. Count and Say1.1问题描述 The count-and-say sequence is the sequence of integers with the first five terms as following: 数数并说序列是一个整数序列,第二项起每一项的值为对前一项的计数,其前五项如下: 1. 1 2. 11 3...原创 2018-04-08 12:42:07 · 319 阅读 · 0 评论 -
leetcode(14):39. Combination Sum
1.leetcode39. Combination Sum1.1问题描述 Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. ...原创 2018-04-09 11:43:09 · 309 阅读 · 0 评论 -
leetcode(15):jump game
这次我们讲解跳跃游戏的两道题,这两道题在leetcode上分别是中等和困难的,但是其实并不比有些简单题难。1.55. Jump Game1.1问题描述 Given an array of non-negative integers, you are initially positioned at the first index of the array. 给定一个非负整数数组...原创 2018-04-10 22:19:48 · 475 阅读 · 0 评论 -
leetcode(16):最长公共子串/最长公共子序列
最近BAT等一线大厂面试的热门题目,就是求最长公共子串子序列问题,Leetcode上面没有完全相同的题目,但是有类似的题目,让我们一起来看看。1.leetcode#718. Maximum Length of Repeated Subarray1.1题目描述 Given two integer arrays A and B, return the maximum lengt...原创 2018-04-17 13:33:31 · 17084 阅读 · 4 评论 -
leetcode(17):连续子串和/乘积最大
另一个比较常见的问题是,求连续子串的和/乘积最大。1.leetcode#53. Maximum Subarray1.1题目描述 Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and ret...原创 2018-04-17 15:47:14 · 1411 阅读 · 0 评论 -
leetcode(18):回溯问题
回溯有一系列问题,例如求一些排列和组合的问题。这里有大神的统一思路,我们来汉化一把。1.leetcode:78.Subsets1.1问题描述 Given a set of distinct integers, nums, return all possible subsets (the power set).Example Input: nums = [1,2,3...原创 2018-04-20 18:55:17 · 548 阅读 · 0 评论 -
leetcode(19):Anagrams (字谜游戏)
1.leetcode:49. Group Anagrams1.1问题描述 Given an array of strings, group anagrams together.Example: Input: [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”], Output: [ [“ate”,”eat”,”te...原创 2018-04-21 17:23:34 · 431 阅读 · 0 评论 -
leetcode(20):Best Time to Buy and Sell Stock(买卖股票的最佳时机)
好久没刷算法了,也很久没来CSDN了,今天又重新刷一下。 这次我们还是从最熟悉的股票买卖开始。1.leetcode#121.Best Time to Buy and Sell Stock1.1问题描述 Say you have an array for which the ith element is the price of a given stock on day i. ...原创 2018-07-24 20:39:51 · 381 阅读 · 0 评论 -
leetcode(21) about arrays
今天主要是介绍一些关于数组相关的题目。1.leetcode387 First Unique Character in a string1.1题目描述 Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -...原创 2018-07-29 11:14:39 · 341 阅读 · 0 评论 -
leetcode(22): House Rober(打家劫舍)
0.写在前面这次我们讲一下房子盗窃者的问题,说白了就是动态规划。1.House Robber(198)1.1 题目描述 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only ...原创 2018-09-03 10:52:28 · 431 阅读 · 0 评论 -
leetcode(23): Jewels and Stones(771 石头与宝石)
1. 问题描述You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many o...原创 2019-04-07 14:02:21 · 373 阅读 · 0 评论 -
leetcode(24):Unique Paths(不同路径)
这周我们重温一下经典的格子世界。1. Unique Paths(不同路径 62)1.1问题描述A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any ...原创 2019-04-14 18:52:56 · 417 阅读 · 0 评论