Given an integer, write a function to determine if it is a power of two.My initial code: 1 class Solution: 2 # @param {integer} n 3 # @return ...
分类:
其他好文 时间:
2015-07-19 16:24:03
阅读次数:
112
You are given a string,s, and a list of words,words, that are all of the same length. Find all starting indices of substring(s) insthat is a concatena...
分类:
其他好文 时间:
2015-07-09 14:26:16
阅读次数:
137
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.
For example, given the following matrix:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
...
分类:
其他好文 时间:
2015-06-03 17:45:21
阅读次数:
101
Contain Duplicate II:Given an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such thatnums[...
分类:
其他好文 时间:
2015-05-31 12:13:16
阅读次数:
106
KMP算法的实现:#include #include #include int strStr(char* haystack, char* needle) { if (haystack == NULL || needle == NULL) return -1; if (nee...
分类:
其他好文 时间:
2015-05-29 11:41:11
阅读次数:
89
题目:
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 and the nodes have the same value.
C代码...
分类:
其他好文 时间:
2015-05-19 22:47:09
阅读次数:
147
题目:
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.
C代码:
/**
* Definition for singly-linked list...
分类:
其他好文 时间:
2015-05-19 22:46:09
阅读次数:
141
题目:
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
Credits:
Special...
分类:
其他好文 时间:
2015-05-19 22:45:51
阅读次数:
194
题目:
Given an array and a value, remove all instances of that value in place and return the new length.
The order of elements can be changed. It doesn't matter what you leave beyond the new len...
分类:
编程语言 时间:
2015-05-19 22:44:15
阅读次数:
135
题目:Reverse a singly linked list
C代码:
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode* reverseList(struct List...
分类:
其他好文 时间:
2015-05-19 20:57:20
阅读次数:
128