摘要:
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文
摘要:
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Note: 题目大意:给定一个数组,返回小标[i, j]的元素之和。 用途:在 阅读全文
摘要:
Given the array arr of positive integers and the array queries where queries[i] = [Li, Ri], for each query i compute the XOR of elements from Li to Ri 阅读全文
摘要:
Given a string s formed by digits ('0' - '9') and '#' . We want to map s to English lowercase characters as follows: Characters ('a' to 'i') are repre 阅读全文
摘要:
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Example 阅读全文
摘要:
引言 很多情况下,我们可以将数据结果保存到txt文件中便于后续查看或者再处理,然而为了进行汇报、论文撰写等工作,我们将数据放入表格,为后续整理会提供极大的便利。我们可以利用pandas库进行numpy.ndarray数据保存到excel。 函数说明 pandas.DataFrame.to_excel 阅读全文
摘要:
A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses strings, and +represents string concaten 阅读全文
摘要:
Given an array of non-negative integers arr, you are initially positioned at start index of the array. When you are at index i, you can jump to i + ar 阅读全文
摘要:
Given two binary search trees root1 and root2. Return a list containing all the integers from both trees sorted in ascending order. Example 1: Example 阅读全文
摘要:
引言 基于低分辨率的图像恢复高分辨图像具有重要意义,近年来,利用深度学习做单张图像超分辨主要有两个大方向:1、减小失真度(distortion, 意味着高PSNR)的图像超分辨,这类方法主要最小化均方误差;2、提高感知质量(perception)的图像。这类方法主要利用GAN来做约束,使得生成的图像 阅读全文
摘要:
引言 直方图是一种对数据分布的描述,在图像处理中,直方图概念非常重要,应用广泛,如图像对比度增强(直方图均衡化),图像信息量度量(信息熵),图像配准(利用两张图像的互信息度量相似度)等。 1、numpy中histogram()函数用于统计一个数据的分布 numpy.histogram(a, bins 阅读全文
摘要:
引言 在进行科学计算的过程的中,很多时候我们需要将中间的计算结果保存下来以便后续查看,或者还需要后续再进行分析处理。 解决方案 1、一维/二维数组保存/载入 特别地,针对一维/二维数组保存,numpy自带savetxt函数有实现;针对保存在txt文件中的数组,numpy自带loadtxt函数。接下来 阅读全文
摘要:
u/U:表示unicode字符串 不是仅仅是针对中文, 可以针对任何的字符串,代表是对字符串进行unicode编码。 一般英文字符在使用各种编码下, 基本都可以正常解析, 所以一般不带u;但是中文, 必须表明所需编码, 否则一旦编码转换就会出现乱码。 建议所有编码方式采用utf-8,即在py文件开头 阅读全文
摘要:
There are n people whose IDs go from 0 to n - 1 and each person belongs exactly to one group. Given the array groupSizes of length n telling the group 阅读全文
摘要:
1、注释多行 1). 首先按esc进入命令行模式下,按下Ctrl + v,进入VISUAL BLOCK模式; 2). 在行首使用上下键选择需要注释的多行; 3). 按下键盘(大写)“I”键,进入插入模式; 4). 然后输入注释符(“//”、“#”等); 5). 最后按下“Esc”键。 注:在按下es 阅读全文
摘要:
You are given a map of a server center, represented as a m * n integer matrix grid, where 1 means that on that cell there is a server and 0 means that 阅读全文
摘要:
On a plane there are n points with integer coordinates points[i] = [xi, yi]. Your task is to find the minimum time in seconds to visit all points. You 阅读全文
摘要:
Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: 题 阅读全文
摘要:
Suppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is constructed by these N numbers successfully if one of t 阅读全文
摘要:
Ants Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 33420 Accepted: 12441 Description An army of ants walk on a horizontal pole of length 阅读全文
摘要:
In a gold mine grid of size m * n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty. Return the ma 阅读全文
摘要:
Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most significant d 阅读全文
摘要:
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Example 1: Ex 阅读全文
摘要:
torch.narrow(input, dim, start, length) → Tensor Returns a new tensor that is a narrowed version of input tensor. The dimension dim is input from star 阅读全文
摘要:
repeat(*sizes) → Tensor Repeats this tensor along the specified dimensions. Unlike expand(), this function copies the tensor’s data. WARNING torch.rep 阅读全文
摘要:
Students are asked to stand in non-decreasing order of heights for an annual photo. Return the minimum number of students not standing in the right po 阅读全文
摘要:
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
摘要:
Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order. Examp 阅读全文
摘要:
Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another ar 阅读全文
摘要:
Given n and m which are the dimensions of a matrix initialized by zeros and given an array indices where indices[i] = [ri, ci]. For each pair of [ri, 阅读全文
摘要:
Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even. Sort the array so that whenever A[i] 阅读全文
摘要:
Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Example 2: Note:You may assume the string contains only 阅读全文
摘要:
Given a collection of intervals, merge all overlapping intervals. Example 1: Example 2: 题目大意:合并区间,[1,3]和[2,6]有交集,合并[1,6]。 思路一:先将数组排序,优先根据区间的第一个数排序,小的排 阅读全文
摘要:
Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Exampl 阅读全文
摘要:
Given a 32-bit signed integer, reverse digits of an integer. Example 1: Example 2: Example 3: Note:Assume we are dealing with an environment which cou 阅读全文
摘要:
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: No 阅读全文
摘要:
You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/ve 阅读全文
摘要:
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
摘要:
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. For example, two is written as II in Roman numeral, just two one's 阅读全文
摘要:
Given a collection of numbers that might contain duplicates, return all possible unique permutations. Example: 思路 阅读全文