摘要:
单调栈做法 42. 接雨水 public class mylist { public static int trap(int[] height) { int lens = height.length; // 形成凹槽至少需要三个圆柱,少于三个无法实现 if(lens<=2) return 0; // 阅读全文
摘要:
设计单调栈 class Solution { class MyQueue{ Deque<Integer> deque = new LinkedList<>(); // 弹出元素时,比较当前要弹出的数值是否等于队列出口的数值,如果相等则弹出 public void poll(int val){ if( 阅读全文
摘要:
public class Main { public static void main(String[] args) { int a = 12, b = 18; int gcd = gcd(a, b); int lcm = lcm(a, b); System.out.println("最大公因数:" 阅读全文