算法
文章平均质量分 57
Ontheroad_
这个作者很懒,什么都没留下…
展开
-
最长回文子串 马拉车算法
最长回文子串,马拉车算法原创 2022-07-10 15:35:17 · 332 阅读 · 0 评论 -
二叉树中所有路径 & 二叉树和为某一值的路径
class Solution { public int pathSum(TreeNode root, int sum) { findPath(root,new Stack<Integer>()); return 0; } public static void findPath(TreeNode root,Stack&lt...原创 2019-03-13 20:06:37 · 211 阅读 · 0 评论 -
连续子数组的最大和 & 53. Maximum Subarray
方法一class Solution { public int maxSubArray(int[] nums) { if(nums.length == 0) return 0; int max = Integer.MIN_VALUE; int curNum = 0; for(int i=0;i<n...原创 2019-03-13 21:13:27 · 278 阅读 · 0 评论 -
(2012蓝桥杯) 奇怪的比赛 某电视台举办了低碳生活大奖赛。题目的计分规则相当奇怪: 每位选手需要回答10个问题(其编号为1到10),越后面越有难度。
(校内2017java程序设计大赛、2012蓝桥杯)某电视台举办了低碳生活大奖赛。题目的计分规则相当奇怪:每位选手需要回答10个问题(其编号为1到10),越后面越有难度。答对的,当前分数翻倍;答错了则扣掉与题号相同的分数(选手必须回答问题,不回答按错误处理)。每位选手都有一个起步的分数为10分。某获胜选手最终得分刚好是100分,如果不让你看比赛过程,你能推断出他(她)哪个题原创 2017-11-28 18:50:47 · 3459 阅读 · 0 评论 -
【LeetCode】35. Search Insert Position
【LeetCode】35. Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array.原创 2017-09-11 16:27:49 · 294 阅读 · 0 评论 -
【LeetCode】27. Remove Element
【LeetCode】27. Remove Element Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.The order of elements can be chang原创 2017-09-10 11:04:24 · 253 阅读 · 0 评论 -
【LeetCode】26. Remove Duplicates from Sorted Array
【LeetCode】26. Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonce and return the new length.Do not allocate extra space for another array, you must do this in pl原创 2017-09-09 18:19:12 · 303 阅读 · 0 评论 -
【LeetCode】 7. Reverse Integer
【LeetCode】 7. Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Note:The input is assumed to be a 32-bit signed integer. Your function should return原创 2017-08-24 22:37:24 · 244 阅读 · 0 评论 -
【LeetCode】1. Two Sum
【LeetCode】1. Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use thesame原创 2017-08-17 09:45:38 · 240 阅读 · 0 评论 -
【LeetCode】21. Merge Two Sorted Lists
【LeetCode】21. Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.原创 2017-08-24 22:30:11 · 284 阅读 · 0 评论 -
【LeetCode】20. Valid Parentheses
Given a string containing just the characters '(', ')','{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all valid b原创 2017-08-21 10:23:38 · 232 阅读 · 0 评论 -
算法基础-字符移位
腾讯2017暑期实习生编程题 算法基础-字符移位原创 2017-08-07 18:47:11 · 375 阅读 · 0 评论 -
Buy a Shovel
Polycarp urgently needs a shovel! He comes to the shop and chooses an appropriate one. The shovel that Policarp chooses is sold for k burles. Assume that there is an unlimited number of suc原创 2017-05-14 09:37:54 · 364 阅读 · 0 评论