Halo

A magic place for coding

0%

Introduction

  相信大家开始学习C/C++的时候,都会遇上memcpy这个函数。简单来说这个是一个拷贝函数,使用方法很简单,但在今天这篇博客,我将来探讨一下里面的实现细节,尝试自己也实现一个具备基本功能的memcpy

Read more »

Problem

There is an undirected connected tree with n nodes labeled from 0 to n - 1 and n - 1 edges.

You are given the integer n and the array edges where edges[i] = [ai, bi] indicates that there is an edge between nodes ai and bi in the tree.

Return an array answer of length n where answer[i] is the sum of the distances between the ith node in the tree and all other nodes.

Read more »

Problem

You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever.

  • For example, if routes[0] = [1, 5, 7], this means that the 0th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ... forever.

You will start at the bus stop source (You are not on any bus initially), and you want to go to the bus stop target. You can travel between bus stops by buses only.

Return the least number of buses you must take to travel from source to target. Return -1 if it is not possible.

Read more »

Problem

You are given an array trees where trees[i] = [xi, yi] represents the location of a tree in the garden.

You are asked to fence the entire garden using the minimum length of rope as it is expensive. The garden is well fenced only if all the trees are enclosed.

Return the coordinates of trees that are exactly located on the fence perimeter.

Read more »

Introduction

  相信熟悉C/C++的朋友都知道,如果我们把一个字符串转为数字,我们常常会使用到atoi()这个函数。那么今天我们就来自己动手实现一个atoi(),这个也是面试中经常会考的题目。

Read more »

Introduction

  今天我们来谈谈一种非常经典的网络攻击——DDos(Distributed Denial-of-service)。这种攻击是一种很常见的攻击,它可以发生在网络模型的每一层,在这篇博客我将和大家分享一下DDos攻击的基本原理,以及我们目前有什么手段能够防御。

Read more »

Introduction

  最近在看很多新推出的数据库和消息中间件的文档时,都会发现它们主推一个点,叫存储与计算分离,那到底什么时候存储与计算分离?为什么现在趋势都是这样,有什么好处?在这篇博客我将和大家简单分享。

Read more »