
LeetCode
路漫漫其修远兮
AStupidHorse
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
走格子和求区间内素数平均值
最近参加了一个线上笔试,记录下里面两道题 grid path 从一个田字格(2X2)的左上角出发,只允许向右或向下移动,恰好有6条路径。则对于20X15的,从左上角出发到右下角的路径共有多少条? 思路:画图很直观。 这里先把图转换为二维矩阵,则2X2的图对应的矩阵为(3,3),grid=[[0,0,0],[0,0,0],[0,0,0]]。由于只能向右或者向下,所以第一行以及第一列的路径都是1。即grid[0][x]=0,x in range(0,n+1),grid[y][0]=0,y in range(0原创 2020-09-18 10:31:04 · 360 阅读 · 0 评论 -
leetcode-20. 有效的括号
description Given a string containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same...转载 2020-02-07 23:08:58 · 169 阅读 · 0 评论 -
leetcode-13. 罗马数字转整数
description Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D ...原创 2020-02-07 23:01:06 · 154 阅读 · 0 评论 -
leetcode-09. 回文数
leetcode T09 description Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121...原创 2020-02-07 22:27:48 · 145 阅读 · 0 评论 -
leetcode-07. 整数反转
leetcode T07 description Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: As...原创 2020-02-07 22:23:11 · 138 阅读 · 0 评论 -
leetcode-01. 两数之和
leetcode T01 description Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and y...原创 2020-02-07 22:18:13 · 163 阅读 · 0 评论 -
leetcode-14. 最长公共前缀
leetcode T14 description Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”. Example 1: Input: [“flower”,“fl...原创 2020-02-07 22:12:49 · 130 阅读 · 0 评论