解法都在代码里,不懂就留言或者私信 /*** Definition for singly-linked list.* public class ListNode {* int val;* ListNode next;* ListNode() {}* ListNode(int val) { this.val = val; }* ListNode(int v
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example: Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, exc
题目 给你一个整数数组 nums 和一个整数 k ,请你统计并返回 该数组中和为 k 的子数组的个数 。 子数组是数组中元素的连续非空序列。 示例 1: 输入:nums = [1,1,1], k = 2 输出:2 解 class Solution {public int subarraySum(int[] nums, int k) {int n = nums.length;int su
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For example, Given {1,2,3,4}, reorder it to {1,4
习题143、生成一个新列表,-1的左边都是小于它的,右边都是大于它的。a= [-1,2,3,-3,0,-5,5] a = [-1,2,3,-3,0,-5,5]base = a[0]list1=[]list2=[]for num in a:if num <base:list1.append(num)else:list2.append(num)print(list1 + [base] +