📣 Back to School开学季 - VIP通行证5折优惠!蓝莓、Offer多多同步优惠
楼主: ttgao
跳转到指定楼层
上一主题 下一主题
收起左侧

立贴!从今天开始刷题。

🔗
 楼主| ttgao 2019-9-11 13:00:46 | 只看该作者
全局:
66. Plus One

Given a non-empty array of digits representing a non-negative integer, plus one to the integer.

The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit.

You may assume the integer does not contain any leading zero, except the number 0 itself.

Example 1:

Input: [1,2,3]
Output: [1,2,4]
Explanation: The array represents the integer 123.
Example 2:

Input: [4,3,2,1]
Output: [4,3,2,2]
Explanation: The array represents the integer 4321.
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-11 13:01:34 | 只看该作者
全局:
这题挺有意思的。如果数组变成一位的话,只需要0位设置为1就可以了,其他的都是0.
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-11 13:20:28 | 只看该作者
全局:
70. Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Note: Given n will be a positive integer.

Example 1:

Input: 2
Output: 2
Explanation: There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps
Example 2:

Input: 3
Output: 3
Explanation: There are three ways to climb to the top.
1. 1 step + 1 step + 1 step
2. 1 step + 2 steps
3. 2 steps + 1 step
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-11 13:20:47 | 只看该作者
全局:
排列组合所有可能性。
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-11 13:25:04 | 只看该作者
全局:
83. Remove Duplicates from Sorted List

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: 1->2->3
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-11 13:25:32 | 只看该作者
全局:
这题没取巧的地方,就是判断是否相同然后删除。
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-22 07:35:26 | 只看该作者
全局:
今天用swift重涮了下面题目。

1        Two Sum                   
7        Reverse Integer                   
9        Palindrome Number                   
13        Roman to Integer                   
14        Longest Common Prefix                   
20        Valid Parentheses                   
21        Merge Two Sorted Lists                   
26        Remove Duplicates from Sorted Array                   
27        Remove Element                   
28        Implement strStr()                   
35        Search Insert Position                   
38        Count and Say                   
53        Maximum Subarray                   

回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-23 12:42:47 | 只看该作者
全局:
今天用swift重涮了下面题目。
66        Plus One                   
67        Add Binary                   
69        Sqrt(x)                   
70        Climbing Stairs                   
83        Remove Duplicates from Sorted List                   
88        Merge Sorted Array                   
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-24 10:10:10 | 只看该作者
全局:
今天用swift重涮了下面题目。

100        Same Tree                   
101        Symmetric Tree                   
104        Maximum Depth of Binary Tree                   
107        Binary Tree Level Order Traversal II                   
108        Convert Sorted Array to Binary Search Tree                   
110        Balanced Binary Tree                   
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-24 12:48:07 | 只看该作者
全局:
今天用swift重涮了下面题目。
111. Minimum Depth of Binary Tree
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表