上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 37 下一页
摘要: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2017-07-23 18:34 immjc 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For 阅读全文
posted @ 2017-07-23 18:13 immjc 阅读(122) 评论(0) 推荐(0) 编辑
摘要: The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another n 阅读全文
posted @ 2017-07-23 17:06 immjc 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, return fa 阅读全文
posted @ 2017-07-22 22:03 immjc 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of three. Follow up:Could you do it without using any loop / recursion? 判断一个数是否是3的幂,则 阅读全文
posted @ 2017-07-22 21:53 immjc 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of two. 判断一个整数是否是2的幂。如果一个数是2的幂,则这个数的二进制表示中,最高位是1,其他位都是0。这个数-1的二进制位全是1。所以我们可以利用这个规律对两个 阅读全文
posted @ 2017-07-22 21:39 immjc 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 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 intege 阅读全文
posted @ 2017-07-21 18:16 immjc 阅读(139) 评论(0) 推荐(0) 编辑
摘要: We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an integer arra 阅读全文
posted @ 2017-07-21 17:40 immjc 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a 阅读全文
posted @ 2017-07-21 17:19 immjc 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 1 蛮力算法 1.1 算法描述 蛮力串匹配是最直接最直觉的方法。可假想地将文本串和模式串分别写在两条印有等间隔方格的纸带上,文本串对应的纸带固定,模式串纸带的首字符与文本串纸带的首字符对齐,两个都沿水平方向放置。于是,只需将P(长度m)与T(长度n)中长度为m的n - m + 1个子串逐一对比,即可 阅读全文
posted @ 2017-07-20 15:48 immjc 阅读(498) 评论(0) 推荐(0) 编辑
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 37 下一页