摘要:
public class RemoveLeftmostSubstring { public static String removeLeftmostSubstring(String input, String target) { while (true) { int index = input.in 阅读全文
摘要:
public class MaxProduct { public static int maxProduct(int[] arr) { if (arr == null || arr.length < 2) { return 0; } int max1 = Integer.MIN_VALUE, max 阅读全文
摘要:
source code 主方法 主类 public class SumOfProperElements { public static int sumOfProper(int[] nums) { int sum = 0; for (int i = 0; i < nums.length; i++) { 阅读全文
摘要:
// CPT101 Practical Exercise 1.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> int main( 阅读全文
摘要:
// 不用递归,用迭代的方式实现二叉树的三序遍历 public class BinaryTreeTraversalIteration { public static class TreeNode { public int val; public TreeNode left; public TreeN 阅读全文
摘要:
// 递归序的解释 // 用递归实现二叉树的三序遍历 public class BinaryTreeTraversalRecursion { public static class TreeNode { public int val; public TreeNode left; public Tre 阅读全文
摘要:
// 最小栈 // 测试链接 : https://leetcode.cn/problems/min-stack/ public class GetMinStack { // 提交时把类名、构造方法改成MinStack class MinStack1 { public Stack<Integer> d 阅读全文
摘要:
// 用栈实现队列 // 用队列实现栈 public class ConvertQueueAndStack { // 测试链接 : https://leetcode.cn/problems/implement-queue-using-stacks/ class MyQueue { public St 阅读全文
摘要:
public class QueueStackAndCircularQueue { // 直接用java内部的实现 // 其实内部就是双向链表,常数操作慢 public static class Queue1 { // java中的双向链表LinkedList // 单向链表就足够了 public 阅读全文