自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 资源 (5)
  • 收藏
  • 关注

原创 LeetCode1218:逐步分析从最长递增子序列到最长定差子序列

按照最长递增子序列的思路dpclass Solution { public int longestSubsequence(int[] arr, int difference) { // dp[i]: arr[0~i] 中且以i结尾的最长定差子序列 int dp[] = new int[arr.length]; dp[0] = 1; int res = 1; for (int i = 1; i < arr.

2021-11-05 16:16:13 144

原创 IT笔试--动态规划--货币找零问题

题目:你要出去旅游,有N元的预算住酒店,有M家酒店供你挑选,这些酒店都有价格X。 需要你正好花完这N元住酒店(不能多,也不能少)最少能住几晚?返回最少住的天数,没有匹配的返回-1* 比如你有1000元,所有酒店都是大于1000的,则返回-1* 比如你有1000元,有1家1000元的,有1家300,有1家700。则最少能住1晚,最多住2晚(300+700)。返回1* 比如你有10

2017-09-03 20:29:14 1056

原创 LeetCode-Palindrome Number-Java

题目:Determine whether an integer is a palindrome. Do this without extra space.转成字符串,使用额外空间的解法。注意-123321应返回falsepublic boolean isPalindrome(int x) { String string = ""+x; for(int i=0;i<s

2017-09-02 19:34:19 233

原创 LeetCode-Reverse Integer-Java

题目:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Note:The input is assumed to be a 32-bit signed integer. Your f

2017-09-02 19:06:49 226

原创 java_LeetCode_3--Longest Substring Without Repeating Characters

题目;Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answ

2017-08-24 20:02:33 198

原创 LeetCode_2----Add Two Numbers

题目:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and ret

2017-08-23 21:09:32 158

原创 LeetCode---twoSum

题目: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 the sa

2017-08-23 19:46:58 175

原创 24点游戏算法

24点游戏算法问题描述:给出4个1-10的数字,通过加减乘除,得到数字为24就算胜利输入:4个1-10的数字。[数字允许重复,测试用例保证无异常数字]输出:true or falseimport java.util.*;public class Main{public static void main(String args[]) {

2017-08-13 16:35:10 448

原创 24点运算

import java.util.Scanner;     public class Main{             private static boolean isA = false;    private static final int TARGET = 24;    public static void main(String[] args) {     

2017-08-13 16:30:27 306

原创 jAVA 识别有效的IP地址和掩码并进行分类统计

import java.util.*;public class Main{  static int a = 0;     static int b = 0;     static int c = 0;     static int d = 0;     static int e = 0;     static int err = 0;     static

2017-08-12 18:11:57 1269

原创 java 找出所有最长连续重复子串及其个数

import java.util.*;class Pair{ int n; String s; Pair(int n,String s){  this.n = n;  this.s = s; }}public class Main{ public static List fun(String str){  List subs = new ArrayLis

2017-08-12 15:54:30 4226

原创 华为机试题

23.字符串加解密import java.util.*;public class Main {public static void main(String[] args) {// TODO Auto-generated method stubScanner sc = new Scanner(System.in);while(sc.hasNext()){S

2017-08-10 20:41:02 409

java解析json(json-lib-2.4)

java操作json文件的6个包。缺少其一都容易报错。亲测可用,直接导入项目即可 1. commons-beanutils-1.8.0 2. commons-collections-3.2.1 3. commons-lang-2.6 4. commons-logging-1.1.1 5. ezmorph-1.0.6 6. json-lib-2.4-jdk15

2018-02-02

经纬度计算距离、方位角等java源码

1、已知两点经纬度求距离方位角 2、已知一点经纬度、距离、方位角求另一点经纬度。 java源码。本人手敲,亲测简单实用。可用于百度地图、Google地图开发,误差极小基本可忽略。

2018-02-02

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除