- 博客(24)
- 资源 (1)
- 收藏
- 关注

原创 分而治之——找出第K大的数
问题描述: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 1:Input: [3,2,1,5,6,4] and k = 2Output...
2018-09-16 14:39:19
348
原创 np.concatenate
示例:a=np.array([[1,2,3],[4,5,6]])b=np.array([[11,21,31],[7,8,9]])np.concatenate((a,b),axis=0)结果:array([[ 1, 2, 3], [ 4, 5, 6], [11, 21, 31], [ 7, 8, 9]])示例:np.concatenate((a,b),axis=1) #axis=1表示对应行的数组进行拼接结果:ar
2021-01-21 15:42:02
178
原创 将多变量时间序列插值变成相同长度
def transform_to_same_length(x, n_var, max_length): n = x.shape[0] # x的形状(n,var,length) # the new set in ucr form np array ucr_x = np.zeros((n, max_length, n_var), dtype=np.float64) # loop through each time series for i in range(.
2020-12-07 20:50:57
688
原创 将序列转换为相同长度
def transform_to_same_length(x, n_var, max_length): n = x.shape[0] # the new set in ucr form np array ucr_x = np.zeros((n, max_length, n_var), dtype=np.float64) # loop through each time series for i in range(n): mts = x...
2020-11-23 19:27:04
565
原创 利用np.stack()把不同1 channel的灰度图像合并为3 channel的RGB图
np.stack文档解释:Join a sequence of arrays along a new axis.Theaxisparameter specifies the index of the new axis in the dimensions of the result. For example, ifaxis=0it will be the first dimension and ifaxis=-1it will be the last dimension.产生一个给...
2020-09-17 17:29:16
723
原创 x[:,:,None,:]-x[:,:,:,None]
x[:,:,None,:]-x[:,:,:,None]None相当于在数组中多加一个维度。输入:x = np.arange(24).reshape((2,3,4))输出:array([[[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]], [[12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23]]]) x
2020-09-16 21:29:21
5525
原创 Remove Element
问题描述: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 array, you must do this by modifying the inp...
2018-12-29 21:21:41
133
原创 Search Insert Position
问题描述:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the a...
2018-12-29 11:24:52
134
原创 Count and Say
问题描述:The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11.11 is re...
2018-12-29 11:16:08
124
原创 Merge Two Sorted Lists
问题描述:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Out...
2018-12-29 10:57:37
109
原创 Remove Duplicates from Sorted Array
问题描述:Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by ...
2018-12-29 10:45:43
123
原创 Implement strStr()
问题描述:Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2...
2018-12-29 10:33:23
117
原创 Add Two Numbers
问题描述:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and r...
2018-12-29 10:23:55
120
原创 2018年百度之星资格赛总结及解析
参赛时间:2018年8月4日—2018年8月6日参赛队员:15332019张胜利 15332018张千艺目录1、问题描述和解题思路2、赛事总结及体会问题一:调查问卷度度熊为了完成毕业论文,需要收集一些数据来支撑他的论据,于是设计了一份包含 m 个问题的调查问卷,每个问题只有 'A' 和 'B' 两种选项。将问卷散发出去之后,...
2018-12-23 18:55:04
455
原创 整数转罗马数字
问题描述:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...
2018-12-02 22:52:22
125
原创 Longest Common Prefix
问题描述: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 "".Example 1:Input: ["flower","flow","flight"]...
2018-11-18 23:37:11
94
原创 罗马数字转换
问题描述:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...
2018-11-11 23:31:09
699
原创 反转数
问题描述:Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we ...
2018-11-11 23:26:16
176
原创 TWO Sum
问题描述:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use th...
2018-10-28 21:18:49
120
原创 平衡二叉树
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as:a binary tree in which the depth of the two subtrees of every node never differ by more than 1.Example 1:Given the following tree [3,9
2018-10-21 21:49:22
122
原创 Intersection of Two Linked Lists
问题描述:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘ ...
2018-10-14 22:56:24
115
原创 二叉树的深度
问题描述:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note: A leaf is a node with no ...
2018-10-07 23:10:45
101
原创 判断二叉树是否相同
问题描述:Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.E...
2018-10-07 22:54:59
338
原创 leeocde-Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums2 are m and n respectively. You may assume tha...
2018-09-09 11:03:20
158
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人