摘要: Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equals 阅读全文
posted @ 2017-07-18 14:17 immjc 阅读(152) 评论(0) 推荐(0) 编辑
摘要: A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents 阅读全文
posted @ 2017-07-17 21:31 immjc 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Reverse a singly linked list. Hint: A linked list can be reversed either iteratively or recursively. Could you implement both? 迭代。 递归。 阅读全文
posted @ 2017-07-17 16:27 immjc 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Example 2: Note: 将数组按照逆序排序后,如果数组元素都是整数, 阅读全文
posted @ 2017-07-17 16:23 immjc 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Example 2: Note: 求给定字母组成的最长回文串,使用map记录元 阅读全文
posted @ 2017-07-17 15:55 immjc 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 将一串罗马数字转换为整数,首先使用map建立罗马字母与数字的表示法则。然后从右向左遍 阅读全文
posted @ 2017-07-17 15:20 immjc 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2017-07-17 12:33 immjc 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 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.s = "rat", t = 阅读全文
posted @ 2017-07-16 21:55 immjc 阅读(124) 评论(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-07-16 21:46 immjc 阅读(129) 评论(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-07-16 21:17 immjc 阅读(107) 评论(0) 推荐(0) 编辑