自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

carbon06的博客

About linux c++. Later will about routing algorithm, machine learning and deep learning

  • 博客(17)
  • 收藏
  • 关注

原创 [LeetCode] 817. Linked List Components

题目描述We are given head, the head node of a linked list containing unique integer values.We are also given the list G, a subset of the values in the linked list.Return the number of connected comp...

2018-05-31 14:44:58 365

原创 [LeetCode] 807. Max Increase to Keep City Skyline

题目描述In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amoun...

2018-05-30 17:35:24 371

原创 [LeetCode] 841. Keys and Rooms

题目描述There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, …, N-1, and each room may have some keys to access the next room. Formally, each room i has a list of ke...

2018-05-30 12:54:28 954

原创 [LeetCode] 565. Array Nesting

题目描述A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], … } subjected to the rule below.Su...

2018-05-29 20:07:35 149

原创 [LeetCode] 721. Accounts Merge

题目描述Given a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of the account...

2018-05-29 15:55:43 479

原创 [LeetCode] 623. Add One Row to Tree

题目描述Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with value v at the given depth d. The root node is at depth 1.The adding rule is: given a positive in...

2018-05-28 12:12:34 204

原创 [LeetCode] 454. 4Sum II

题目描述Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A, B, C, D have same...

2018-05-25 19:43:19 200

原创 [LeetCode] 542. 01 Matrix

题目描述Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1. Example 1: Input:0 0 00 1 00 0 0Output:0 0 00...

2018-05-24 12:33:44 366

原创 [LeetCode] 836. Rectangle Overlap

题目描述A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates of its top-right corner.Two rectangles ove...

2018-05-22 20:29:10 370

原创 python pip 添加清华镜像

使用pip 安装python 库时连接国外库时,下载需要很长时间,在配置文件中设置国内镜像可以提高速度。 在linux 下创建 ~/.pip/pip.conf 文件。文件内容如下[global]index-url = https://pypi.tuna.tsinghua.edu.cn/simple[install]trusted-host=mirrors.aliyun.com...

2018-05-21 14:54:49 5946

原创 [LeetCode] 832. Flipping an Image

题目描述Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image.To flip an image horizontally means that each row of the image is reversed. For...

2018-05-15 18:51:05 557

原创 [LeetCode] 830. Positions of Large Groups

题目描述In a string S of lowercase letters, these letters form consecutive groups of the same character.For example, a string like S = “abbxxxxzyy” has the groups “a”, “bb”, “xxxx”, “z” and “yy”.Cal...

2018-05-11 11:51:07 338

原创 GCC __builtin_expect 解析

概念摘自gcc的官方文档OtherBuildinFunction.— Built-in Function: long __builtin_expect (long exp, long c)You may use __builtin_expect to provide the compiler with branch prediction information. In general...

2018-05-10 15:43:39 1233

原创 Leveldb LRU Cache 解析

LRU原理LRU 是一种经典的缓存淘汰策略,其原理以及实现可以查看我之前的博客LRU Cache 解析及实现。本文主要解析Leveldb LRU Cache。Leveldb 实现leveldb 实现的lru cache 使用自己实现的简单hash表存储键值对,循环双链表记录每个元素的访问时间,为了提升多线程环境下的读写性能,Leveldb 内部使用LruCache 数组对外提供服务...

2018-05-09 16:53:56 1033

原创 Linux shell 颜色输出

原理可以利用ANSI escape code 实现linux终端输出颜色文本。下面是几个ANSI escape code 对应的颜色。Black 0;30 Dark Gray 1;30Red 0;31 Light Red 1;31Green 0;32 Light Green 1;32Brow...

2018-05-09 14:50:02 379

原创 [Leetcode] 824. Goat Latin

题目描述A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only.We would like to convert the sentence to “Goat Latin” (a made-up langua...

2018-05-09 11:35:20 365

原创 Leveldb Arena 内存池解析

简介Arena 是leveldb 实现的简单的内存池,以最小4096bytes 为单位申请block, 使用指针记录当前block 中空余内存起始位置以及当前block剩余空间。将所有的block 放到blocks_ 数组中。Arena 提供了分配内存以及分配对齐的内存的两种接口,没有释放内存的接口,当Arena 的生命周期结束时,由Arena 的析构函数统一释放内存。Arena 的主要结构如...

2018-05-03 16:38:07 693

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除