![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
文章平均质量分 84
cinrry
这个作者很懒,什么都没留下…
展开
-
Properties类文件的的操作
public class PropertiesTester { public static void main (String[] args){ Properties p = new Properties(); BufferedReader in = null; BufferedWriter out = null; try{转载 2015-07-13 16:01:55 · 272 阅读 · 0 评论 -
LeetCode OJ - Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()转载 2016-02-14 18:02:47 · 275 阅读 · 0 评论 -
LeetCode OJ - Implement strStr()
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.public class Solution { public static int strStr(String ha原创 2016-02-19 22:07:38 · 267 阅读 · 0 评论 -
LeetCode OJ - 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.原创 2016-02-19 22:57:04 · 328 阅读 · 0 评论 -
LeetCode OJ - Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found原创 2016-02-21 18:43:17 · 373 阅读 · 0 评论 -
LeetCode OJ - Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with原创 2016-02-22 15:49:46 · 261 阅读 · 0 评论 -
LeetCode OJ - Search in Rotated Sorted Array
Suppose a sorted array 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 found in the array retur转载 2016-02-23 17:23:35 · 450 阅读 · 0 评论 -
Java反转单链表(code)
class Node { private int record; //变量 private Node nextNode; //指向下一个对象 public Node(int record) { super(); this.record = record; } publi转载 2016-03-25 16:14:58 · 268 阅读 · 0 评论 -
LeetCode OJ - Remove Nth Node From End of List
publicclass Solution { publicListNode removeNthFromEnd(ListNode head, intn) { // Note: The Solution object is instantiated only once and is reused by each test ca转载 2016-03-25 16:42:14 · 456 阅读 · 0 评论 -
Leetcode OJ -Remove Nth Node From End of List
public static boolean isValid(String s) { HashMap map = new HashMap(); map.put('(', ')'); map.put('[', ']'); map.put('{', '}'); Stack stack = new Stack(); for (int i = 0; i < s.length(); i++转载 2016-03-25 16:57:53 · 245 阅读 · 0 评论 -
LeetCode OJ - Merge Two Sorted Lists
public class Solution { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode p1 = l1; ListNode p2 = l2; ListNode fakeHead = new ListNode(0); ListN转载 2016-03-25 17:21:51 · 274 阅读 · 0 评论 -
LeetCode OJ - Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit st原创 2016-01-12 22:24:32 · 334 阅读 · 0 评论 -
LeetCode OJ - Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i,原创 2016-01-09 22:57:08 · 8843 阅读 · 0 评论 -
LeetCode OJ - Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.my answer:public class Solution { public static String longestCommonPrefix(String[] strs) { Str原创 2016-01-10 14:00:55 · 267 阅读 · 0 评论 -
LeetCode OJ - Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe原创 2016-01-08 10:52:04 · 315 阅读 · 0 评论 -
LeetCode OJ - Add two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link原创 2016-01-08 15:57:01 · 320 阅读 · 0 评论 -
LeetCode OJ - ZigZag Conversation
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I原创 2016-01-08 17:00:42 · 312 阅读 · 0 评论 -
LeetCode OJ - Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before c原创 2016-01-08 18:13:57 · 314 阅读 · 0 评论 -
LeetCode OJ - String to Integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca原创 2016-01-09 10:26:36 · 329 阅读 · 0 评论 -
LeetCode OJ - Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.my answer:public class Solution_9 { public static boolean isPalindrome(int x) { boolean flag = true; Stri原创 2016-01-09 17:32:11 · 298 阅读 · 0 评论 -
LeetCode OJ - Integer to Roman
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.my answer:public class Solution { public String intToRoman(int num) { Str原创 2016-01-09 18:25:12 · 324 阅读 · 0 评论 -
LeetCode OJ - Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.my answer:public class Solution { public static int toNumber(char ch) {原创 2016-01-09 18:27:05 · 257 阅读 · 0 评论 -
LeetCode OJ - 3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exact原创 2016-01-11 18:40:31 · 424 阅读 · 0 评论 -
LeetCode OJ - 3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.my answer:import java.util.*;publ原创 2016-01-11 15:04:29 · 281 阅读 · 0 评论 -
校招java编程模版
import java.util.*;public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ } }}原创 2016-08-02 13:21:53 · 333 阅读 · 1 评论