摘要: Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1: Exa 阅读全文
posted @ 2017-12-29 10:23 icychen 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
posted @ 2017-12-28 17:25 icychen 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice ver 阅读全文
posted @ 2017-12-28 17:12 icychen 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n 阅读全文
posted @ 2017-12-28 17:02 icychen 阅读(109) 评论(0) 推荐(0) 编辑
摘要: A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128 阅读全文
posted @ 2017-12-27 17:13 icychen 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the or 阅读全文
posted @ 2017-12-27 17:09 icychen 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 有一个单向链表,链表当中有可能出现“环”。如何用程序判断出这个链表是有环链表? 方法一:首先从头节点开始,依次遍历单链表的每一个节点。每遍历到一个新节点,就从头节点重新遍历新节点之前的所有节点,用新节点ID和此节点之前所有节点ID依次作比较。如果发现新节点之前的所有节点当中存在相同节点ID,则说明该 阅读全文
posted @ 2017-12-18 19:19 icychen 阅读(1430) 评论(0) 推荐(0) 编辑
摘要: 众所周知,HashMap是一个用于存储Key-Value键值对的集合,每一个键值对也叫做Entry。这些个键值对(Entry)分散存储在一个数组当中,这个数组就是HashMap的主干。 HashMap数组每一个元素的初始值都是Null。 对于HashMap,我们最常使用的是两个方法:Get 和 Pu 阅读全文
posted @ 2017-12-18 15:35 icychen 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 题目:一个无序数组里有99个不重复正整数,范围从1到100,唯独缺少一个整数。如何找出这个缺失的整数? 解法一: 创建一个HashMap,以1到100为键,值都是0 。然后遍历整个数组,每读到一个整数,就找到HashMap当中对应的键,让其值加一。 由于数组中缺少一个整数,最终一定有99个键对应的值 阅读全文
posted @ 2017-12-18 15:11 icychen 阅读(731) 评论(0) 推荐(0) 编辑
摘要: 最近实验室要用ckeditor,踩了几个小坑记录下。 1.出现iframe跨域问题 response.setHeader("X-Frame-Options", "SAMEORIGIN");或者在websecurityconfig中添加http.headers().frameOptions().dis 阅读全文
posted @ 2017-11-14 15:52 icychen 阅读(658) 评论(0) 推荐(0) 编辑