![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
一:算法基础(lettcode)
文章平均质量分 63
一枚卷毛
想要转入java行业的学生一枚,希望有更多的技术分享
展开
-
1.1数组和链表:19. Remove Nth Node From End of List(Leetcode)
Given a linked list, remove the nth node from the end of list and return its head.题目大意:给定一个链表,删除它倒数第n位的节点并重新返回此链表博主想到的方法比较简单,先遍历一次求出链表的长度,确定是正数第几个节点被删除,然后二次遍历删除它方法一:class Solution { publ原创 2017-11-07 11:20:11 · 141 阅读 · 0 评论 -
Search a 2D Matrix:二分查找二维数组
二分查找二维数组原创 2018-02-11 14:45:11 · 241 阅读 · 0 评论 -
Unique Paths && Unique Paths|| 尾递归的简化,数学排列组合,动态规划
动态规划原创 2018-02-11 14:15:24 · 315 阅读 · 0 评论 -
Jump Game(55题):贪心算法,数组
Jump Game原创 2018-02-11 13:43:21 · 286 阅读 · 0 评论 -
树:98. Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keysless than the node's key.The原创 2018-02-03 17:18:24 · 133 阅读 · 0 评论 -
1.1数组和链表:189. Rotate Array(Leetcode)
Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note:Try to come up as many solutions as yo转载 2017-11-05 14:54:10 · 165 阅读 · 0 评论 -
1.1数组和链表:160. Intersection of Two Linked Lists(Leetcode)
Write a program tofind the node at which the intersection of two singly linked lists begins. Notes:If the two linked lists have no intersection at all, return null.The linked lists must reta原创 2017-11-02 15:08:35 · 130 阅读 · 0 评论 -
1.1 数组和链表:169.Majority Element (Leetcode)
一道经典的面试题,找出数组中出现半数以上的元素(不包含半数)。先贴代码:public int majorityElement(int[] nums) { int result = 0,count = 0; for(int i = 0;i < nums.length;i ++){ if(count == 0){原创 2017-11-02 13:47:25 · 134 阅读 · 0 评论 -
1.4 字符串:168. Excel Sheet Column Title(Leetcode)
1.4 字符串题目要求:按EXCEL的序A~Z,AA~ZZ,...将给定正整数转化为此序列i.e: 1 ..... A,2.....B,26......Z,27.......AA.public String convertToTitle(int n) { String ret = ""; while(n > 0)原创 2017-11-02 10:46:18 · 211 阅读 · 0 评论 -
1.1数组和链表:61. Rotate List(Leetocde)
Given a list, rotate the list to the right by k places, where k is non-negativeExample:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.这道题是我做的比较满意的,因为用到了经验,说一下我自己的解法:大众原创 2017-11-08 16:19:59 · 168 阅读 · 0 评论 -
1.4字符串:60.Permutation Sequence(Leetocde)
The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213""231""312原创 2017-11-08 15:48:58 · 256 阅读 · 0 评论 -
1.1数组和链表:33. Search in Rotated Sorted Array(Leetcode)
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If foun原创 2017-11-07 13:39:15 · 128 阅读 · 0 评论 -
Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2-&...原创 2018-02-11 15:14:42 · 142 阅读 · 0 评论