Removing duplicate elements and only keeping the unique items in an array (or vector, list) is easy. We can use std::unique method from STL. The std::unique (from algorithms header) …
The Union-Find (Disjoint Set) is a commonly-used algorithm that can solve e.g. Minimal Spanning Tree. The following is a Java implementation of a Union-Find Class. package com.helloacm; public class …
Leetcode has become a de-facto standard for preparing your coding interview. The leetcode has a very useful feature – which is mocking interview. You can mock coding interviews for …
The Harddrives failing rate is increasing year by year – and according to statistics, most harddrives’s Annualized Failure Rate (AFR) is between 0 to 2%. It is common that …
Consider the following function to make changes to an array of numbers: func modify(arr, op, idx) { // add by 1 index idx if (op == 0) { arr …
My another old hardrive is suddenly dead without any notice. Luckily, most of the files are on Cloud – and I can just replace it with a new drive …