摘要: A peak element is an element that is greater than its neighbors. Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return 阅读全文
posted @ 2018-10-09 18:10 一丝清风一抹红尘 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Let's call an array A a mountain if the following properties hold: A.length >= 3 There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[ 阅读全文
posted @ 2018-10-09 16:33 一丝清风一抹红尘 阅读(102) 评论(0) 推荐(0) 编辑
摘要: International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" map 阅读全文
posted @ 2018-10-09 12:51 一丝清风一抹红尘 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runti 阅读全文
posted @ 2018-10-08 13:27 一丝清风一抹红尘 阅读(88) 评论(0) 推荐(0) 编辑
摘要: Write a function that takes a string as input and returns the string reversed. Example 1: Input: "hello" Output: "olleh" Example 2: Input: "A man, a p 阅读全文
posted @ 2018-09-30 13:00 一丝清风一抹红尘 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the numbe 阅读全文
posted @ 2018-09-30 11:27 一丝清风一抹红尘 阅读(109) 评论(0) 推荐(0) 编辑