随笔分类 -  java

摘要:对整数开方 思路:二分法,牛顿迭代法 java: 牛顿迭代法 阅读全文
posted @ 2017-10-11 18:59 wilderness 阅读(109) 评论(0) 推荐(0)
摘要:计算二进制 java: 阅读全文
posted @ 2017-10-11 18:48 wilderness 阅读(139) 评论(0) 推荐(0)
摘要:旋转链表 思路: 把链表连接为一个闭合的环,然后从头计数,到位置剪开 java: 阅读全文
posted @ 2017-10-11 17:38 wilderness 阅读(131) 评论(0) 推荐(0)
摘要:螺旋矩阵 Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example,Given n = 3, You should return the fo 阅读全文
posted @ 2017-10-11 14:29 wilderness 阅读(111) 评论(0) 推荐(0)
摘要:求最后一个单词的长度 Java 1: java 2: Java 3: 阅读全文
posted @ 2017-10-10 17:26 wilderness 阅读(170) 评论(0) 推荐(0)
摘要:这个题在《剑指offer》上面讲过 思路: 1.利用递归 2.遍历,每遍历到一个新的数索引为i,就复制i个新的数组,并且把这个新的数插入新复制出来的数组的各个位置上 java: python: 阅读全文
posted @ 2017-10-10 15:40 wilderness 阅读(173) 评论(0) 推荐(0)
摘要:顺时针旋转图片(矩阵)90度 思路: 转置矩阵+水平旋转180度 java代码: Python代码: 阅读全文
posted @ 2017-10-10 13:35 wilderness 阅读(182) 评论(0) 推荐(0)
摘要:1 import java.util.*; 2 3 public class SelectOnlys { 4 long S1 = 2 ^ 16; 5 6 7 int whichSeg(long s) { 8 long L = S1; 9 int flag = 0; 10 while (s >= ... 阅读全文
posted @ 2017-09-17 22:02 wilderness 阅读(1240) 评论(0) 推荐(0)
摘要:先看程序: 运行结果为: i am static in the init_cls classstatic is the class Ai am in the class A!i am in the init_cls 从结果中可以看到,当我们只是使用一个类中的方法的时候(在这里使用的init_cls中 阅读全文
posted @ 2017-05-06 10:49 wilderness 阅读(263) 评论(0) 推荐(0)