自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

evolone的专栏

每天一小步

  • 博客(11)
  • 收藏
  • 关注

原创 leetcode-190&191 Reverse Bits & Number of 1 Bits

一、190 Reverse Bits Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in bina

2015-07-08 12:01:39 372

原创 leetcode-205 Isomorphic Strings

Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with another chara

2015-07-07 21:33:56 381

原创 leetcode-202 Happy Number

Write an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of i

2015-07-07 15:29:13 338

原创 leetcode-203 Remove Linked List Elements

Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5题意清楚,主要考察链表指针的使用。 小心头结点和尾节点的处理。 时间36ms。

2015-07-07 11:41:00 359

原创 leetcode-204 Count Primes

Count the number of prime numbers less than a non-negative number, n. 计算小于n的素数的个数。 素数,从2开始,2,3,5,7,11…… 素数定义,除了被1和自身整除外,没有其他因数。 最直接的想法就是从2开始到n的平方根,如果有能整除的,就不是素数。 最直接的往往效率最低。果然,虽然不断剪枝,但是本身的效率低下,再怎么

2015-07-06 21:28:30 414

原创 leetcode-206 Reverse Linked List

Reverse a singly linked list. 题意简单,考察对链表的熟练程度。主要注意链表指针的变化。代码如下:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), ne

2015-07-06 18:26:33 439

原创 leetcode-223 Rectangle Area

Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure. Assume that the total area is n

2015-07-06 17:26:55 411

原创 leetcode-231 Power of Two

Given an integer, write a function to determine if it is a power of two. 题目就是求输入整数n,是否为2的幂。 考虑特殊情况,输入为负数、0,1,2,3,4,5. 若为负数和0,false; 1,2,4,true; 3,5,false; 只要n>1,若n%2 != 0;则false; 否则 n = n/2; 时间

2015-07-06 16:04:52 288

原创 leetcode-21 Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.题目很简单,就是考察队链表插入的熟悉程度。 12ms。 代码:/** * Definition for singl

2015-07-03 21:55:28 321

原创 leetcode-105&106 Construct Binary Tree from Preorder and Inorder Traversal I&II

Given preorder and inorder traversal of a tree, construct the binary tree.思路简单,但是实现起来就复杂了。思路:发现,前序的第一个为根,然后在中序中找到根,在中序中,根的左边是左子树,右边是右子树。然后递归进入左子树与右子树。可是由于在左子树的时候,坐标会错位,没办法对齐,纠结了很久,还是无法解决。最后求助于强大的百度……发现

2015-07-03 19:46:07 339

原创 leetcode-10 Regular Expression Matching

Implement regular expression matching with support for ‘.’ and ‘*’.‘.’ Matches any single character. ‘*’ Matches zero or more of the preceding element.The matching should cover the entire input string

2015-07-01 20:05:52 393

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除