diff --git a/algorithms/java/FindDuplicateSubtrees.java b/algorithms/java/FindDuplicateSubtrees.java index 7a14a2d..be7f208 100644 --- a/algorithms/java/FindDuplicateSubtrees.java +++ b/algorithms/java/FindDuplicateSubtrees.java @@ -22,9 +22,9 @@ ************************************************************************************************ */ public class FindDuplicateSubtrees { - public List findDuplicateSubtrees(TreeNode root) { - - } +// public List findDuplicateSubtrees(TreeNode root) { +// +// } public static class TreeNode { int val; diff --git a/algorithms/java/KthLargestNumberInMultiplicationTable.java b/algorithms/java/KthLargestNumberInMultiplicationTable.java new file mode 100644 index 0000000..42a2607 --- /dev/null +++ b/algorithms/java/KthLargestNumberInMultiplicationTable.java @@ -0,0 +1,16 @@ +import java.util.PriorityQueue; + +/** + * Created by yang on 17-8-27. + */ +public class KthLargestNumberInMultiplicationTable { + public int findKthNumber(int m, int n, int k) { + PriorityQueue + } + + public static void main(String[] args) { + KthLargestNumberInMultiplicationTable kthLargestNumberInMultiplicationTable = new KthLargestNumberInMultiplicationTable(); + + System.out.println(kthLargestNumberInMultiplicationTable.findKthNumber(3,3,5) + " <---> 3"); + } +} diff --git a/algorithms/java/NonDecreasingArray.java b/algorithms/java/NonDecreasingArray.java new file mode 100644 index 0000000..328f2ab --- /dev/null +++ b/algorithms/java/NonDecreasingArray.java @@ -0,0 +1,30 @@ +/** + * Created by yang on 17-8-27. + */ +public class NonDecreasingArray { + public boolean checkPossibility(int[] nums) { + if (nums == null || nums.length <= 1) { + return true; + } + int count = 0; + for (int i = 1; i < nums.length; i++) { + if (nums[i] < nums[i-1]) { + if (count > 0) { + return false; + } + if (i == 1 || (i > 1 && nums[i] >= nums[i-2])) { + count++; + } else if (i == nums.length - 1 || (i < nums.length - 1 && nums[i+1] >= nums[i-1])) { + count++; + } else { + return false; + } + } + } + + return true; + } +// [4,2,3] true +// [4,2,1] false +// [2,3,3,2,4] true +} diff --git a/algorithms/java/StrangePrinter.java b/algorithms/java/StrangePrinter.java new file mode 100644 index 0000000..138b45f --- /dev/null +++ b/algorithms/java/StrangePrinter.java @@ -0,0 +1,32 @@ +/** + * Created by yang on 17-8-27. + ************************************************************************************************ + * There is a strange printer with the following two special requirements: + * The printer can only print a sequence of the same character each time. At each turn, the + * printer can print new characters starting from and ending at any places, and will cover the + * original existing characters. Given a string consists of lower English letters only, your job + * is to count the minimum number of turns the printer needed in order to print it. + * + * Example 1: + * Input: "aaabbb" + * Output: 2 + * Explanation: + * Print "aaa" first and then print "bbb". + * + * Example 2: + * Input: "aba" + * Output: 1 + * Explanation: + * Print "aaa" first and then print "b" from the second place of the string, which will + * cover the existing character 'a'. + * + * Note: + * Length of the given string will not exceed 100. + ************************************************************************************************ + */ +public class StrangePrinter { +// https://discuss.leetcode.com/category/1480/strange-printer +// public int strangePrinter(String s) { +// +// } +} diff --git a/algorithms/java/test.java b/algorithms/java/test.java new file mode 100644 index 0000000..2546bfb --- /dev/null +++ b/algorithms/java/test.java @@ -0,0 +1,8 @@ +import java.util.LinkedHashMap; + +/** + * Created by yang on 17-10-16. + */ +public class test { + LinkedHashMap +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy