摘要: "题目" Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 分析 整数转化为罗马数字字符串 罗马数字: 采用七个罗马字母作数字、即Ⅰ( 阅读全文
posted @ 2017-02-18 16:04 妙音天女 阅读(180) 评论(0) 推荐(0) 编辑
摘要: "题目" Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 分析 罗马数字字符串转化成整数 罗马数字: 采用七个罗马字母作数字、即Ⅰ( 阅读全文
posted @ 2017-02-18 15:49 妙音天女 阅读(420) 评论(0) 推荐(0) 编辑
摘要: "题目" You are given a map in form of a two dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontal 阅读全文
posted @ 2017-02-18 11:07 妙音天女 阅读(114) 评论(0) 推荐(0) 编辑
摘要: "题目" Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime c 阅读全文
posted @ 2017-02-18 10:58 妙音天女 阅读(173) 评论(0) 推荐(0) 编辑
摘要: "题目" Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farth 阅读全文
posted @ 2017-02-18 10:54 妙音天女 阅读(168) 评论(0) 推荐(0) 编辑
摘要: "题目" Calculate the sum of two integers a and b, but you are not allowed to use the operator + and . Example: Given a = 1 and b = 2, return 3. 分析 不用+ 号 阅读全文
posted @ 2017-02-18 10:50 妙音天女 阅读(151) 评论(0) 推荐(0) 编辑
摘要: "题目" Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1 阅读全文
posted @ 2017-02-18 10:35 妙音天女 阅读(191) 评论(0) 推荐(0) 编辑
摘要: "题目" 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 to 3 阅读全文
posted @ 2017-02-18 10:23 妙音天女 阅读(136) 评论(0) 推荐(0) 编辑
摘要: "题目" Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first t 阅读全文
posted @ 2017-02-18 10:20 妙音天女 阅读(141) 评论(0) 推荐(0) 编辑
摘要: "题目" Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". 分析 字符串反转 解答 解法1:(我)(7m 阅读全文
posted @ 2017-02-18 10:14 妙音天女 阅读(154) 评论(0) 推荐(0) 编辑