上一页 1 ··· 3 4 5 6 7 8 9 10 下一页
摘要: 492: 给定一个面积值,求它的长l和宽w。长和宽需满足:长大于等于宽,长和宽的差值尽可能小,长乘宽等于面积。 思路:先将l和w初始化为sqrt(area),然后看l*w是否等于面积,如果等于则返回l和w,若小则将l加一,若大则将w减一。 阅读全文
posted @ 2017-04-09 21:39 蓦然闻声 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 22. 242. 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 = 阅读全文
posted @ 2017-04-09 21:39 蓦然闻声 阅读(192) 评论(0) 推荐(0) 编辑
摘要: Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 阅读全文
posted @ 2017-04-09 21:38 蓦然闻声 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a 阅读全文
posted @ 2017-04-09 21:36 蓦然闻声 阅读(159) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return 0. 阅读全文
posted @ 2017-04-09 21:35 蓦然闻声 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文
posted @ 2017-04-09 21:34 蓦然闻声 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element 阅读全文
posted @ 2017-04-09 21:33 蓦然闻声 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left leaves in the binary tree, with values 9 and 1 阅读全文
posted @ 2017-04-09 21:33 蓦然闻声 阅读(59) 评论(0) 推荐(0) 编辑
摘要: Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the rans 阅读全文
posted @ 2017-04-09 21:32 蓦然闻声 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n  阅读全文
posted @ 2017-04-09 21:31 蓦然闻声 阅读(94) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 下一页