摘要:最近在看java se 的IO 部分 , 看到 java 的文件的压缩和解压比较有意思,主要用到了两个IO流-ZipInputStream, ZipOutputStream,不仅可以对文件进行压缩,还可以对文件夹进行压缩和解压。 ZipInputStream位于java.util.zip包下。下面是
阅读全文
摘要:一、设计原则 封装变化 多用组合,少用继承 针对接口编程,不针对实现编程 为交互对象之间的松紧耦合设计而努力 对扩展开放,都修稿关闭 依赖抽象,不要依赖具体类 最少知识原则:之和朋友交谈 好莱坞原则:别找我,我会找你(由超类主控一切,当他们需要的时候,自然回去调用子类) 类应该只有一个改变的理由 二
阅读全文
摘要:题目: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-
阅读全文
摘要:题目: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the
阅读全文
摘要:题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation a
阅读全文
摘要:题目: 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, retur
阅读全文
摘要:题目: Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum
阅读全文
摘要:题目:Reverse String (难度一颗星) Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh". 实现:
阅读全文