摘要: Given an array of numbersnums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements t... 阅读全文
posted @ 2015-10-25 08:34 fenshen371 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about this?Here are som... 阅读全文
posted @ 2015-10-25 07:05 fenshen371 阅读(88) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".思路:学习这种代码的简洁写法。 1 class Solution { 2 public: 3 ... 阅读全文
posted @ 2015-10-25 06:50 fenshen371 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a ... 阅读全文
posted @ 2015-10-25 05:47 fenshen371 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Given apatternand a stringstr, find ifstrfollows the same pattern.Herefollowmeans a full match, such that there is a bijection between a letter inpatt... 阅读全文
posted @ 2015-10-25 05:39 fenshen371 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner as shown ... 阅读全文
posted @ 2015-10-25 02:07 fenshen371 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?思路:将链表前半部分反转,对比就行了。 1 class Solution... 阅读全文
posted @ 2015-10-25 01:10 fenshen371 阅读(125) 评论(0) 推荐(0) 编辑