摘要: There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every 阅读全文
posted @ 2018-11-02 21:33 hopskin1 阅读(153) 评论(0) 推荐(0) 编辑
摘要: In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For 阅读全文
posted @ 2018-11-02 21:13 hopskin1 阅读(200) 评论(0) 推荐(0) 编辑
摘要: An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, 阅读全文
posted @ 2018-10-26 23:22 hopskin1 阅读(224) 评论(0) 推荐(0) 编辑
摘要: Implement a magic directory with buildDict, and search methods. For the method buildDict, you'll be given a list of non-repetitive words to build a di 阅读全文
posted @ 2018-10-26 22:47 hopskin1 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Alice and Bob have candy bars of different sizes: A[i] is the size of the i-th bar of candy that Alice has, and B[j] is the size of the j-th bar of ca 阅读全文
posted @ 2018-10-25 07:50 hopskin1 阅读(198) 评论(0) 推荐(0) 编辑
摘要: A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possibl 阅读全文
posted @ 2018-10-25 07:27 hopskin1 阅读(289) 评论(0) 推荐(0) 编辑
摘要: Return any binary tree that matches the given preorder and postorder traversals. Values in the traversals pre and post are distinct positive integers. 阅读全文
posted @ 2018-10-25 06:21 hopskin1 阅读(337) 评论(0) 推荐(0) 编辑
摘要: Given a string S of '(' and ')' parentheses, we add the minimum number of parentheses ( '(' or ')', and in any positions ) so that the resulting paren 阅读全文
posted @ 2018-10-24 22:49 hopskin1 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 小Q定义了一种数列称为翻转数列:给定整数n和m, 满足n能被2m整除。对于一串连续递增整数数列1, 2, 3, 4..., 每隔m个符号翻转一次, 最初符号为'-';。例如n = 8, m = 2, 数列就是: -1, -2, +3, +4, -5, -6, +7, +8.而n = 4, m = 1 阅读全文
posted @ 2018-10-19 23:58 hopskin1 阅读(874) 评论(0) 推荐(0) 编辑
摘要: Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even. Sort the array so that whenever A[i]  阅读全文
posted @ 2018-10-14 21:29 hopskin1 阅读(508) 评论(0) 推荐(1) 编辑