Little BishopsA bishop is a piece used in the game of chess which is played on a board of square grids. A bishop can only move diagonally from its cur...
分类:
其他好文 时间:
2014-07-09 23:05:17
阅读次数:
252
Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.题解:因为题目要求原地算法,所以我们只能利用矩阵第一行和第一列存放置零信息。首先遍历第一行和第一列,看他们是否需要全部置零...
分类:
其他好文 时间:
2014-07-08 23:58:29
阅读次数:
422
Ruby has its own style to define the abstract methods in its class....
分类:
其他好文 时间:
2014-07-08 19:45:49
阅读次数:
145
Singleton is one design pattern in the software engineering. Ruby has its own special feature to declare singleton class...
分类:
其他好文 时间:
2014-07-08 18:05:25
阅读次数:
213
题目
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant spac...
分类:
其他好文 时间:
2014-07-08 13:46:26
阅读次数:
205
Problem DescriptionI think that you might have played the traditional Chinese ring game: The Chinese Linking Rings (here we call its nickname Jiulianh...
分类:
其他好文 时间:
2014-07-06 17:06:04
阅读次数:
293
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.public class Solution { public...
分类:
其他好文 时间:
2014-07-06 13:50:22
阅读次数:
153
Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o...
分类:
其他好文 时间:
2014-07-03 23:51:47
阅读次数:
408
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.
分类:
其他好文 时间:
2014-07-03 23:46:37
阅读次数:
389
SPOJ Problem Set (classical)
694. Distinct Substrings
Problem code: DISUBSTR
Given a string, we need to find the total number of its distinct substrings.
Input
T- number of ...
分类:
其他好文 时间:
2014-07-03 16:32:42
阅读次数:
212