N-Queens II
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
思路:解决了上题,这题也就迎刃而解,或者说这题要不上题还要简单一些。
具体代码如下:
pub...
分类:
其他好文 时间:
2015-07-13 16:19:17
阅读次数:
111
Rotate Image
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
思路:其实就是旋转数组,没有什么难度,代码如下:
public ...
分类:
其他好文 时间:
2015-07-13 14:05:28
阅读次数:
569
Palindrome Linked ListGiven a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?https://leetco...
分类:
编程语言 时间:
2015-07-12 17:00:30
阅读次数:
261
FMG:follow my girl. 前两天把,我妹子跟我说,老师布置得作业写不出来了,我说,给我看看,说不定我能帮到你。 拿过来一看,傻了眼了,为毛是servlet,jsp,tomcat啥啊。 博主为何如此蛋疼,因为博主对于Web这一块,只熟悉HTML/CSS/JS的内容,什么javaWe...
分类:
编程语言 时间:
2015-07-12 00:05:16
阅读次数:
187
Palindrome Linked ListGiven a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?将链表拆成两半,后一半反转后...
分类:
其他好文 时间:
2015-07-11 18:23:04
阅读次数:
155
386.You have just performed a FLASHBACK TABLE operation using the following command:
flashback table employees to scn 123456;
The employees table has triggers associated with it. Which of the follow...
分类:
其他好文 时间:
2015-07-11 15:13:30
阅读次数:
153
You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?In order to fulfill...
分类:
其他好文 时间:
2015-07-11 13:35:43
阅读次数:
135
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?思路:
把链表一分为二,把右边的一半翻转,再逐个比对左右的链表即可。/**
* Definition for singly-linked list.
* struc...
分类:
其他好文 时间:
2015-07-10 23:46:56
阅读次数:
388
题目:Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a function...
分类:
其他好文 时间:
2015-07-10 18:28:45
阅读次数:
105
https://leetcode.com/problems/palindrome-linked-list/Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) tim...
分类:
其他好文 时间:
2015-07-10 13:04:13
阅读次数:
66