摘要: class Solution { public int[] relativeSortArray(int[] arr1, int[] arr2) { int k = 0; int t = 0; int[] res = new int[arr1.length]; ... 阅读全文
posted @ 2019-08-01 17:26 CodingYM 阅读(85) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; class Solution { public int[] intersection(int[] nums1, int[] nums2) { Set set1 = new HashSet(); int len = nums1.length> nums2.length? nums2.length:nums... 阅读全文
posted @ 2019-08-01 16:28 CodingYM 阅读(81) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int twoCitySchedCost(int[][] costs) { if(costs[0].length ==0||costs.length==0) return 0; int [] arr = new int[co... 阅读全文
posted @ 2019-08-01 13:13 CodingYM 阅读(141) 评论(0) 推荐(0) 编辑
摘要: class Solution { public boolean isRobotBounded(String instructions) { int len = instructions.length(); int x = 0; int y = 0; in... 阅读全文
posted @ 2019-08-01 10:16 CodingYM 阅读(151) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int lastStoneWeight(int[] stones) { int len = stones.length; int i = len -1; int minus = 0; int remain = len; if(s... 阅读全文
posted @ 2019-07-31 17:55 CodingYM 阅读(98) 评论(0) 推荐(0) 编辑
摘要: class Solution { public String removeDuplicates(String S) { String result =""; int len = S.length(); Stack st = new Stack(); ... 阅读全文
posted @ 2019-07-31 17:20 CodingYM 阅读(203) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int heightChecker(int[] heights) { int [] tmp = heights.clone(); Arrays.sort(tmp); int result = 0; for(int i = 0... 阅读全文
posted @ 2019-07-31 16:06 CodingYM 阅读(82) 评论(0) 推荐(0) 编辑
摘要: Without using Reccursion 阅读全文
posted @ 2019-07-31 14:57 CodingYM 阅读(100) 评论(0) 推荐(0) 编辑
摘要: Flyweight pattern is primarily used to reduce the number of objects created decrease memory footprint increase performance. Flyweight pattern tries to 阅读全文
posted @ 2019-07-31 11:54 CodingYM 阅读(306) 评论(0) 推荐(0) 编辑
摘要: In Proxy pattern, a class represents functionality of another class. This type of design pattern comes under structural pattern. Below is the diagram 阅读全文
posted @ 2019-07-31 11:09 CodingYM 阅读(188) 评论(0) 推荐(0) 编辑