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

立贴!从今天开始刷题。

🔗
 楼主| ttgao 2019-7-4 14:07:10 | 只看该作者
全局:
这题有点意思,就是调整步长的问题。
回复

使用道具 举报

🔗
 楼主| ttgao 2019-7-12 23:38:43 | 只看该作者
全局:
35. Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

You may assume no duplicates in the array.

Example 1:

Input: [1,3,5,6], 5
Output: 2
Example 2:

Input: [1,3,5,6], 2
Output: 1
Example 3:

Input: [1,3,5,6], 7
Output: 4
Example 4:

Input: [1,3,5,6], 0
Output: 0
回复

使用道具 举报

🔗
 楼主| ttgao 2019-7-12 23:39:00 | 只看该作者
全局:
此题查找一下就可以了。
回复

使用道具 举报

🔗
 楼主| ttgao 2019-8-6 13:15:07 | 只看该作者
全局:
重新开始刷题!
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-6 12:58:13 | 只看该作者
全局:
43. Multiply Strings

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

Example 1:

Input: num1 = "2", num2 = "3"
Output: "6"
Example 2:

Input: num1 = "123", num2 = "456"
Output: "56088"
Note:

The length of both num1 and num2 is < 110.
Both num1 and num2 contain only digits 0-9.
Both num1 and num2 do not contain any leading zero, except the number 0 itself.
You must not use any built-in BigInteger library or convert the inputs to integer directly.
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-6 12:58:43 | 只看该作者
全局:
此题就是用数组的办法来解决乘法的问题。
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-11 10:20:11 | 只看该作者
全局:
27. Remove Element

Given an array nums and a value val, remove all instances of that value in-place and return the new length.

Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.

The order of elements can be changed. It doesn't matter what you leave beyond the new length.

Example 1:

Given nums = [3,2,2,3], val = 3,

Your function should return length = 2, with the first two elements of nums being 2.

It doesn't matter what you leave beyond the returned length.
Example 2:

Given nums = [0,1,2,2,3,0,4,2], val = 2,

Your function should return length = 5, with the first five elements of nums containing 0, 1, 3, 0, and 4.

Note that the order of those five elements can be arbitrary.

It doesn't matter what values are set beyond the returned length.
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-11 10:20:40 | 只看该作者
全局:
这题的解法很巧妙,把删除改成了重新添加!
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-11 10:48:15 | 只看该作者
全局:
38. Count and Say

The count-and-say sequence is the sequence of integers with the first five terms as following:

1.     1
2.     11
3.     21
4.     1211
5.     111221
1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 1211.

Given an integer n where 1 ≤ n ≤ 30, generate the nth term of the count-and-say sequence.

Note: Each term of the sequence of integers will be represented as a string.



Example 1:

Input: 1
Output: "1"
Example 2:

Input: 4
Output: "1211"
回复

使用道具 举报

🔗
 楼主| ttgao 2019-9-11 10:48:31 | 只看该作者
全局:
这题没啥意思,直接抄了答案。
回复

使用道具 举报

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

本版积分规则

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