![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
lintcode
qq_36360008
这个作者很懒,什么都没留下…
展开
-
lintcode 斐波纳契数列
public class Solution { /* * @param n: an integer * @return: an ineger f(n) */ public int fibonacci(int n) { if(n==1){ return 0; }else if(n==原创 2018-01-22 15:09:34 · 102 阅读 · 0 评论 -
lintcode 搜索二维矩阵
public class Solution { /* * @param matrix: matrix, a list of lists of integers * @param target: An integer * @return: a boolean, indicate whether matrix contains target *原创 2018-01-26 20:55:54 · 155 阅读 · 0 评论 -
lintcode 平面列表
public class Solution { // @param nestedList a list of NestedInteger // @return a list of integer public List flatten(List nestedList) { List list=new ArrayList();原创 2018-01-26 20:26:08 · 205 阅读 · 0 评论 -
lintcode 二分查找
class Solution { /** * @param nums: The integer array. * @param target: Target to find. * @return: The first position of target. Position starts from 0. */ public int原创 2018-01-26 17:39:11 · 140 阅读 · 0 评论 -
lintcode 字符串查找
public class Solution { /* * @param source: source string to be scanned. * @param target: target string containing the sequence of characters to match * @return: a index to the原创 2018-01-26 17:05:20 · 133 阅读 · 0 评论 -
lintcode fizz buzz问题
public class Solution { /* * @param n: An integer * @return: A list of strings. */ public List fizzBuzz(int n) { List list=new ArrayList(); for(int i=1;i原创 2018-01-26 16:41:50 · 274 阅读 · 0 评论 -
lintcode 旋转字符串
public class Solution { /* * @param str: An array of char * @param offset: An integer * @return: nothing */ public void rotateString(char[] str, int offset) {原创 2018-01-26 16:32:55 · 143 阅读 · 0 评论 -
lintcode 合并排列数组 II
public class Solution { /* * @param A: sorted integer array A * @param B: sorted integer array B * @return: A new sorted integer array */ public int[] mergeSortedArra原创 2018-01-26 15:59:01 · 117 阅读 · 0 评论 -
lintcode A+B
利用位运算来解决A+B的问题,可以将此问题转化为解决不进位相加和进位(carry bit)的两部分问题:1. 首先是不进位相加:x = A^B 先对A和B进行异或运算(XOR manupitation) , A 和B 中两位不相同的变为1,相同的变为 0, 同为1是不进位2. 其次是进位 y =(A&B)所以 A+B = A^B + (A&B)3.在循环中(A&B转载 2018-01-25 23:08:18 · 201 阅读 · 0 评论 -
lintcode 二叉树遍历
/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val = val; * this原创 2018-01-22 19:09:54 · 138 阅读 · 0 评论 -
lintcode 删除链表中的元素
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */public class Solution { /*原创 2018-01-22 15:50:53 · 146 阅读 · 0 评论 -
lintcode 35. 翻转链表
/** * Definition for ListNode. * public class ListNode { * int val; * ListNode next; * ListNode(int val) { * this.val = val; * this.next = null; * } * } */public class ...原创 2018-03-01 11:25:34 · 155 阅读 · 0 评论