杨帆博客

你想开发游戏还是改变世界?


  • 首页

  • 标签

  • 归档

  • 搜索

Reverse-String-II

发表于 2018-01-06 | 更新于: 2018-08-22

LeetCode#541 Reverse String II

  Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of them. If there are less than 2k but greater than or equal to k characters, then reverse the first k characters and left the other as original.

阅读全文 »

Target-Sum

发表于 2018-01-05 | 更新于: 2018-08-22

LeetCode#494 Target Sum

  You are given a list of non-negative integers, a1, a2, …, an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new symbol.

  Find out how many ways to assign symbols to make sum of integers equal to target S.

阅读全文 »

Find-The-Duplicate-Number

发表于 2018-01-01 | 更新于: 2018-08-22

LeetCode#287 Find the Duplicate Number

  Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.

阅读全文 »

Base7

发表于 2017-12-30 | 更新于: 2018-08-22

LeetCode#504 Base7

  Given an integer, return its base 7 string representation.

Example 1:

1
2
Input: 100
Output: "202"

Example 2:

1
2
Input: -7
Output: "-10"

Note: The input will be in range of [-1e7, 1e7].

阅读全文 »

Random-Pick-Index

发表于 2017-12-29 | 更新于: 2018-08-22

LeetCode#398 Random Pick Index

  Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.

阅读全文 »
1…394041…46
KsGin

KsGin

游戏程序员/计算机图形学/Unity/西山居搬砖

226 日志
16 标签
GitHub E-Mail Google Twitter
© 2018 KsGin @ 2018
0%