随笔分类 -  LeetCode

摘要:Reverse Vowels of a String Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = "hello", return 阅读全文
posted @ 2016-05-11 17:41 Juntaran 阅读(238) 评论(0) 推荐(0)
摘要:Excel Sheet Column Title Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> 阅读全文
posted @ 2016-05-10 20:26 Juntaran 阅读(250) 评论(0) 推荐(0)
摘要:Reverse String Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". 阅读全文
posted @ 2016-05-10 19:17 Juntaran 阅读(155) 评论(0) 推荐(0)
摘要:Power of Four Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given num 阅读全文
posted @ 2016-05-10 19:16 Juntaran 阅读(142) 评论(0) 推荐(0)
摘要:Integer Break Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return t 阅读全文
posted @ 2016-05-10 19:16 Juntaran 阅读(217) 评论(0) 推荐(0)
摘要:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r 阅读全文
posted @ 2016-05-10 19:15 Juntaran 阅读(222) 评论(0) 推荐(0)
摘要:Power of Three Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using any loop / recursio 阅读全文
posted @ 2016-05-10 19:15 Juntaran 阅读(143) 评论(0) 推荐(0)
摘要:Bulb Switcher There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you 阅读全文
posted @ 2016-05-10 19:14 Juntaran 阅读(304) 评论(0) 推荐(0)
摘要:Missing Number Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Give 阅读全文
posted @ 2016-05-10 19:12 Juntaran 阅读(167) 评论(0) 推荐(0)
摘要:Valid Anagram Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "nagaram", return true 阅读全文
posted @ 2016-05-10 19:11 Juntaran 阅读(193) 评论(0) 推荐(0)
摘要:Power of Two Given an integer, write a function to determine if it is a power of two. 阅读全文
posted @ 2016-05-10 19:10 Juntaran 阅读(138) 评论(0) 推荐(0)
摘要:Excel Sheet Column Number Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding colu 阅读全文
posted @ 2016-05-10 19:09 Juntaran 阅读(166) 评论(0) 推荐(0)
摘要:Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at lea 阅读全文
posted @ 2016-05-10 19:09 Juntaran 阅读(159) 评论(0) 推荐(0)
摘要:Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You ma 阅读全文
posted @ 2016-05-10 19:08 Juntaran 阅读(196) 评论(0) 推荐(0)
摘要:Maximum Product Subarray Find the contiguous subarray within an array (containing at least one number)which has the largest product. For example, give 阅读全文
posted @ 2016-04-29 16:36 Juntaran 阅读(160) 评论(0) 推荐(0)
摘要:Product of Array Except Self Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all 阅读全文
posted @ 2016-04-29 03:39 Juntaran 阅读(242) 评论(0) 推荐(0)
摘要:Trapping Rain Water Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to 阅读全文
posted @ 2016-04-29 03:38 Juntaran 阅读(168) 评论(0) 推荐(0)
摘要:Container With Most Water Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are dra 阅读全文
posted @ 2016-04-27 02:19 Juntaran 阅读(287) 评论(0) 推荐(0)
摘要:Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would 阅读全文
posted @ 2016-04-25 00:49 Juntaran 阅读(159) 评论(0) 推荐(0)
摘要:Nim Game You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 阅读全文
posted @ 2016-04-24 23:18 Juntaran 阅读(196) 评论(0) 推荐(0)