IncredibleThings

导航

2018年9月20日 #

LeetCode - Rotate String

摘要: We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, if A = 'abcde', then it will be 'bcdea' after on... 阅读全文

posted @ 2018-09-20 20:29 IncredibleThings 阅读(104) 评论(0) 推荐(0) 编辑

LeetCode – Smallest Rotation with Highest Score

摘要: 暴力解法会超时 这道题给了我们一个长度为N的数组,说是数组中的数字的范围都在[0, N]之间,然后定义了一个旋转操作,比如在位置K进行旋转,数组在K位置断开,新数组以A[k]为开头数字,断开的前半段数组直接拼到末尾即可。然后又定义了一种积分规则,说是如果某个坐标位置大于等于其数字的话,得1分,让我们 阅读全文

posted @ 2018-09-20 11:22 IncredibleThings 阅读(136) 评论(0) 推荐(0) 编辑

LeetCode – Most Common Word

摘要: Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at least one word that isn't banned, and that the answe... 阅读全文

posted @ 2018-09-20 10:28 IncredibleThings 阅读(174) 评论(0) 推荐(0) 编辑