8 1LOVESJohnny

尚未进行身份认证

我要认证

暂无相关简介

等级
TA的排名 2w+

LeetCode | 130. Surrounded Regions

题目:Given a 2D board containing'X'and'O'(the letter O), capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region.Example:X X X XX O O XX X O XX O X XAfter running your function...

2020-07-31 23:21:23

LeetCode | 125. Valid Palindrome

题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.Note:For the purpose of this problem, we define empty string as valid palindrome.Example 1:Input: "A man, a plan, a canal: Panama"...

2020-07-31 23:14:16

LeetCode | 124. Binary Tree Maximum Path Sum

题目:Given anon-emptybinary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path must containat least one nodeand ...

2020-07-31 23:13:12

LeetCode | 122. Best Time to Buy and Sell Stock II

题目:Say you have an arraypricesfor which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multipl...

2020-07-31 23:11:01

LeetCode | 121. Best Time to Buy and Sell Stock

题目:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit....

2020-07-31 23:09:25

LeetCode | 120. Triangle

题目:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [6,5,7], [4,1,8,3]]The minimum path sum from t...

2020-07-31 23:07:43

Linux | 拷贝符合特定命名规则的文件: copy certain range of files

在Linux中,拷贝文件操作不可或缺。最简单常用的拷贝指令如下。cp src_file dst_filecp拷贝源文件src_file(source file)为目标文件dst_file(destination file)。在处理大量数据文件时,有时需要拷贝一批文件子集。比如,最近需要从一个大数据集中过滤出一个小子集,用此验证训练流程的正确性等等。简单粗暴的批量拷贝方法是,我们可以根据文件的命名规则,写一个简单的正则表达式,如下。cp *.jpg dst_dir/...

2020-07-10 21:24:34

LeetCode | 119. Pascals Triangle II

题目:Given a non-negativeindexkwherek≤33, return thekthindex row of the Pascal's triangle.Note that the row index starts from0.In Pascal's triangle, each number is the sum of the two numbers directly above it.Example:Input: 3Output: ...

2020-05-31 20:39:48

LeetCode | 118. Pascals Triangle

题目:Given a non-negative integernumRows, generate the firstnumRowsof Pascal's triangle.In Pascal's triangle, each number is the sum of the two numbers directly above it.Example:Input: 5Output:[ [1], [1,1], [1,2,1], [1,3,3,1],...

2020-05-31 20:31:07

LeetCode | 115. Distinct Subsequences

题目:Given a stringSand a stringT, count the number of distinct subsequences ofSwhich equalsT.A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing ...

2020-05-31 20:24:24

LeetCode | 113. Path Sum II

题外话:又到了一月一度的coding time!题目:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.Note:A leaf is a node with no children.Example:Given the below binary tree andsum = 22, 5 / \ ...

2020-05-31 20:21:55

Pytorch | Pytorch框架中模型和数据的gpu和cpu模式:model.to(device), model.cuda(), model.cpu(), DataParallel

背景介绍我们在使用Pytorch训练时,模型和数据有可能加载在不同的设备上(gpu和cpu),在算梯度或者loss的时候,报错信息类似如下:RuntimeError: Function AddBackward0 returned an invalid gradient at index 1 - expected type torch.cuda.FloatTensor but got torch.FloatTensorRuntimeError: Expected object of devi...

2020-05-09 16:46:42

LeetCode | 112. Path Sum

题目:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Note:A leaf is a node with no children....

2020-04-30 18:38:09

LeetCode | 111. Minimum Depth of Binary Tree

题目:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.Note:A leaf is a node with no...

2020-04-30 18:35:49

LeetCode | 109. Convert Sorted List to Binary Search Tree

题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in wh...

2020-04-30 18:34:36

LeetCode | 108. Convert Sorted Array to Binary Search Tree

题目:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which the dept...

2020-04-30 18:32:13

Package | OpenCV C++ cv::Mat 数据类型type对应的输出值

背景:在使用OpenCV C++包时,通常需要访问和修改cv::Mat的数据值。要做到点对点的处理,保证程序的正确性,需要先确定cv::Mat的数据类型type,以确定后续访问cv::Mat数据的调用接口。做法:要确定cv::Mat的数据格式,最直接的做法是调用type API,得到type的输出值。cv::Mat img;/*...image process...

2020-04-21 15:18:30

随笔 | 近期工作感悟

转眼,又历历在目,这篇主要用来记录我的职场感悟,希望可以提醒自己,不忘初心。态度向1. 对于新的领域,新的方向,要勇往直前,保持兴奋。因为本科、研究生,包括工作初期都是接触计算机视觉比较多,我会养成一种思维惯性:其他方向的内容不了解,有些害怕,有些拒绝。有时候工作内容不能太多由自己选择,但是可以切换角度,以拓宽视野,践行快速学习方法的视角去看待。对新的领域好奇,有信心可以搞...

2020-03-31 23:05:41

CV | SRGAN论文笔记:Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network

题外话时隔一年多,距离第一篇SRCNN 超分系列的文章再更新 >.< 随着22个月的过去,超分在工业界的落地趋势逐渐明朗,让我们一起来回顾超分辨率这个领域又一经典里程碑式的方法——基于生成式对抗网络的超分辨率网络 SRGAN。研究背景介绍超分辨率(super resolution)任务的目标是将输入的低分辨率图像,例如256×256的图像,等比例放大若干倍后(如...

2020-03-31 22:04:54

C/C++ | gettimeofday和clock的计时应用及区别

C++程序中通常需要

2020-03-11 23:54:33

查看更多

勋章 我的勋章
  • 持之以恒
    持之以恒
    授予每个自然月内发布4篇或4篇以上原创或翻译IT博文的用户。不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!
  • 勤写标兵Lv4
    勤写标兵Lv4
    授予每个自然周发布9篇以上(包括9篇)原创IT博文的用户。本勋章将于次周周三上午根据用户上周的博文发布情况由系统自动颁发。