Algorithms, Blockchain and Cloud
27  novembre     19h22
Teaching Kids Programming - Repeated K-Length Substrings (Sliding Window)
ACMer    Given a string s and an integer k, return the number of k-length substrings that occur more than once in s. Constraints n 100,000 where n is the length of s. k 10 Example 1 Input s ... br br [[ This is a content summary only. Visit my website for full links, other content, and more ]]
25  novembre     20h28
Teaching Kids Programming - Python Function to Find the Mode in an Array (Most Frequent Number)
ACMer    A Mode in Math is the most frequent number in an array. If there are multiple elements that appear equally the same time, then the mode can be one of them (or the first appearing one). Finding the... br br [[ This is a content summary only. Visit my website for full links, other content, and...
24  novembre     19h44
Teaching Kids Programming - Compute the Number of Sublists by Combination in Math
ACMer    Previously, we know there are 45 continuously increasing digits (each digit is 1 plus its previous digit) such as 12, 23, 12345. This can actually be computed via Math Combination. The numbers are... br br [[ This is a content summary only. Visit my website for full links, other content, and...
22  novembre     20h18
Teaching Kids Programming - Contiguously Increasing Numbers (Depth First Search and Breadth First Search Algorithm)
ACMer    Given two integers start and end, return a sorted list of integers such that every number e is between start e end and the digits of e are contiguously increasing. For example, 2345 is... br br [[ This is a content summary only. Visit my website for full links, other content, and more ]]
    16h39
Handling Command Line Parameters for PHP Script (Turn Parameters into GET POST)
ACMer    The PHP can be used as a scripting language for command line tools. We can access the argc and argv these two variables to access the number of arguments and the command line parameters... br br [[ This is a content summary only. Visit my website for full links, other content, and more ]]
    14h50
How RNG Software Determines Online Progressive Jackpot Winners?
ACMer    Since the online casino industry was established in the mid-1990s, there’s been a lot of developments that perhaps don’t get the credit they deserve from wider media. For example, there... br br [[ This is a content summary only. Visit my website for full links, other content,...
21  novembre     16h56
Teaching Kids Programming - Maximum Depth of N-ary Tree via Depth First Search or Breadth First Search Algorithms
ACMer    Given a n-ary 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. Nary-Tree input serialization is... br br [[ This is a content summary only. Visit my website for full links, other content, and more...
20  novembre     21h42
Teaching Kids Programming - Multi-source Breadth First Search Algorithm (Minimum Number of Moves to Capture the King)
ACMer    You are given a two-dimensional integer matrix board containing 0s, 1s and 2s representing some n x n chessboard. Each 0 represents an empty cell, 1 represents the knight and 2 represents the king.... br br [[ This is a content summary only. Visit my website for full links, other content,...
18  novembre     21h23
Teaching Kids Programming - Remove Last Duplicate Entries (Hash Table)
ACMer    Given a list of integers nums, find all duplicate numbers and delete their last occurrences. Constraints 0 n 100,000 where n is the length of nums Example 1 Input nums Output Example 2 Input... br br [[ This is a content summary only. Visit my website for full links, other content, and...
17  novembre     21h15
Teaching Kids Programming - Graph Traversal Algorithms in DFS or BFS (Unlock Rooms with Keys)
ACMer    There are n rooms labeled from 0 to n – 1 and all the rooms are locked except for room 0. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key.... br br [[ This is a content summary only. Visit my website for full links, other content, and...
15  novembre     17h24
Teaching Kids Programming - Introduction to Prim’s Minimum Spanning Tree (Graph Algorithm)
ACMer    Introduction to Minimum Spanning Tree MST Previously, we have talked about the Kruskal’s MST Algorithm: Teaching Kids Programming - Introduction to Kruskal’s Minimum Spanning Tree (Graph... br br [[ This is a content summary only. Visit my website for full links, other content, and...
14  novembre     10h43
Teaching Kids Programming - Introduction to Kruskal’s Minimum Spanning Tree (Graph Algorithm)
ACMer    What is a Minimum Spanning Tree? A Graph (G) is a collection of vertex V and edges E that is . We want to build a tree T with all vertex where T is a subset of G i.e. A tree does not have a cycles,... br br [[ This is a content summary only. Visit my website for full links, other content,...
13  novembre     20h52
Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)
ACMer    We know the Golden Ratio is defined as the fraction where The post Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) first appeared on Algorithms, Blockchain and... br br [[ This is a content summary only. Visit my website for full links, other content,...
12  novembre     21h39
Teaching Kids Programming - Solving Math Equation n n 19 n-n 0 (Factorial Function and Unbounded Bruteforce Algorithm)
ACMer    Given equation we know the n must be non-negative integers in order for factorial n to make sense. If we bruteforce, we don’t know yet the upperbound, however we can ask computer to try until... br br [[ This is a content summary only. Visit my website for full links, other content,...
11  novembre     21h03
Teaching Kids Programming - Converting (Binary) Trees to Undirectional Graphs via DFS and BFS Algorithms
ACMer    Define Binary Trees in Python Trees can be considered as DAG (Directed Acyclic Graph) – the Directed means that we usually can only visit child nodes from parent nodes and not vice versa. The... br br [[ This is a content summary only. Visit my website for full links, other content,...
10  novembre     18h23
Teaching Kids Programming - Square Root Decomposition to Query Range Sum of Mutable List
ACMer    Given an integer array nums, handle multiple queries of the following types: Update the value of an element in nums. Calculate the sum of the elements of nums between indices left and right inclusive... br br [[ This is a content summary only. Visit my website for full links, other content,...
07  novembre     11h32
Teaching Kids Programming - High Accuracy Multiplication Algorithm (Multiply Strings)
ACMer    Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Note: You must not use any built-in BigInteger library or... br br [[ This is a content summary only. Visit my website for full links, other content, and...
06  novembre     21h04
Teaching Kids Programming - Remove Duplicates from Sorted Array via Two Pointer Algorithm
ACMer    Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same.... br br [[ This is a content summary only. Visit my website for full links, other content,...
05  novembre     22h01
Teaching Kisd Programming - Finding the Length of a Linked List (Recursion and Iterative Algorithm)
ACMer    Given a singly linked list node, return its length. The linked list has fields next and val. Constraints n 100,000 where n is the number of nodes in node Linked List compared to Array List List... br br [[ This is a content summary only. Visit my website for full links, other content, and...
04  novembre     21h13
Teaching Kids Programming - Linear Equation with Two Unknowns (Chicken and Rabbit Problem)
ACMer    Linear Equation with Two Unknowns can be used to solve Chicken and Rabit Problem (R for rabbits, and C for chicken) For heads: For legs: Let’s plug into the second equation, and we get: so so... br br [[ This is a content summary only. Visit my website for full links, other content,...
03  novembre     20h55
Teaching Kids Programming - Single-Row Keyboard via Hash Table
ACMer    There is a special keyboard with all keys in a single row. Given a string keyboard of length 26 indicating the layout of the keyboard (indexed from 0 to 25). Initially, your finger is at index 0. To... br br [[ This is a content summary only. Visit my website for full links, other content,...
02  novembre     19h28
Teaching Kids Programming - Greedy Algorithm to Find Longest Increasing Subsequence in O(NLogN) via Binary Search
ACMer    Given an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is a sequence that can be derived from an array by deleting some or no elements without... br br [[ This is a content summary only. Visit my website for full links, other content, and...
01  novembre     15h55
Teaching Kids Programming - Find Insertion Point in Sorted List via bisect left or bisect right
ACMer    If a list array sorted, we can find the insertion point index of given value x via Binary Search Algorithm – which takes O(LogN) time. In Python, we have bisect left and bisect right from the... br br [[ This is a content summary only. Visit my website for full links, other content,...
31  octobre     20h50
Teaching Kids Programming - Top Down and Bottom Up Dynamic Programming Algorithm to Type N letters on a 2-keys Keyboard
ACMer    There is only one character ‘A’ on the screen of a notepad. You can perform two operations on this notepad for each step: Copy All: You can copy all the characters present on the screen... br br [[ This is a content summary only. Visit my website for full links, other content,...
29  octobre     13h37
Teaching Kids Programming - Run-Length Encoding Compression Algorithm
ACMer    Yesterday, we talked about RunLength Decoding: Teaching Kids Programming - Run-Length Decoding Decompression Algorithm. Run-Length Encoding Compression Algorithm in Python Run-Length encoding is the... br br [[ This is a content summary only. Visit my website for full links, other content,...
28  octobre     19h15
Teaching Kids Programming - Run-Length Decoding Decompression Algorithm
ACMer    Given a string s, consisting of digits and lowercase alphabet characters, that’s a run-length encoded string, return its decoded version. Note: The original string is guaranteed not to have... br br [[ This is a content summary only. Visit my website for full links, other content, and...
27  octobre     20h45
Teaching Kids Programming - The Fisher-Yates Random Shuffle Algorithm in Python
ACMer    Given N items, we know there are total permutation – so if we do a shuffling, each permutation needs to be in theory probability. If we swap two elements N times, then each element need to be... br br [[ This is a content summary only. Visit my website for full links, other content,...
25  octobre     20h41
Teaching Kids Programming - Image Flood Fill via DFS and BFS Algorithm
ACMer    An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, sc) representing the starting pixel (row and... br br [[ This is a content summary only. Visit my website for full links, other content, and...
24  octobre     19h05
Teaching Kids Programming - Estimating the Performance Speedup (Gain) using Amdahls Law
ACMer    Nowadays, CPU has multicore technologies (e.g. multithreading hyper-threading) – which we can employ to speed up the computation tasks. Let’s define the speed up S(N) as the ratio of time... br br [[ This is a content summary only. Visit my website for full links, other content,...
23  octobre     22h46
Different ways of Loading Javascript Files in a Javascript File
ACMer    The javascript (in HTML, the browser DOM i.e. Document Object Model) does not have a inbuilt inherent include method function that allwos us to load dynamically another Javascript file lib. But this... br br [[ This is a content summary only. Visit my website for full links, other content,...
    21h15
Teaching Kids Programming - Divide and Conquer Algorithm Explained (Max Number, Ruler Marker)
ACMer    We have used the Divide and Conquer algorithm to solve some problems earlier. For example, for Hanoi Tower, we solve the problem by dividing into three steps: moving n-1 disks from A to B, moving... br br [[ This is a content summary only. Visit my website for full links, other content, and...
22  octobre     21h30
Teaching Kids Programming - Area and Circumferences of Circle and Monte Carlo Simulation Algorithm of PI
ACMer    The Math constant PI or is an irrational number which cannot be represented by a simple fraction where . The approximation of is 3.14159265358…. A Rational Number is the opposite – where... br br [[ This is a content summary only. Visit my website for full links, other content,...
21  octobre     21h18
Teaching Kids Programming - Remove a Node and Subtree using Depth First Search or Breadth First Search Algorithm
ACMer    Remove a node (and nodes belong to that subtree) from a Tree is the same as The Process Killing Algorithms using Depth First Search or Breadth First Search (Kill a Process): Given n processes, each... br br [[ This is a content summary only. Visit my website for full links, other content,...
19  octobre     21h04
Teaching Kids Programming - Kth Smallest Element in a BST via Iterative Inorder Traversal Algorithm
ACMer    Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. You may assume k is always valid, 1 k BST’s total elements. Example 1: Input: root , k 1... br br [[ This is a content summary only. Visit my website for full links, other content,...
18  octobre     21h13
Teaching Kids Programming - Cousin Nodes in Binary Tree via Breadth First Search & Depth First Search Algorithm
ACMer    In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k 1. Two nodes of a binary tree are cousins if they have the same depth, but have different parents. We... br br [[ This is a content summary only. Visit my website for full links, other content,...
17  octobre     21h08
Teaching Kids Programming - Restore the Word from Rules
ACMer    Given a list of rules in the form of “A-B”, find out the original word. The original word only has unique letters. For example, given , return the original word which is... br br [[ This is a content summary only. Visit my website for full links, other content, and more ]]
16  octobre     22h07
Teaching Kids Programming - Best Time to Buy and Sell Stock (Buy and Sell Once - Three Algorithms)
ACMer    You are given an array prices where prices is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the... br br [[ This is a content summary only. Visit my website for full links, other content,...
15  octobre     21h37
Teaching Kids Programming - Tower of Hanoi via Recursion (Math Induction Proof of Minimal Number of Moves)
ACMer    Introduction to Hanoi Tower Problem Hanoi Tower is a famous math puzzle. There are three rods and N disks. The smaller size of disks need to be always ontop of bigger ones. And one move you are only... br br [[ This is a content summary only. Visit my website for full links, other content,...
14  octobre     20h51
Teaching Kids Programming - Max Subarray Sum by Kadane’s Algorithm
ACMer    Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example 1: Input: nums Output: 6 Explanation: has the... br br [[ This is a content summary only. Visit my website for full links, other content, and...
12  octobre     21h02
Teaching Kids Programming - Introduction to Probability and Naive Bayes Theorem
ACMer    Probability represents the likelyhood of an event that will occur. We can use Venn Graph to study the probability. Probability is a number between or . Conditional Probability of A given B... br br [[ This is a content summary only. Visit my website for full links, other content, and more ...
10  octobre     20h33
Teaching Kids Programming - Introduction to KNN Machine Learning Algorithm (KNN In Python)
ACMer    KNN Machine Learning Algorithm in Python KNN (K Nearnest Neighbours) is a simplest machine learning algorithm. The prediction is made by calculating the K nearest neighbours and then get the average... br br [[ This is a content summary only. Visit my website for full links, other content,...
09  octobre     22h44
Teaching Kids Programming - Build Progressive Stairs Row by Row via Simulation, Binary Search or Math Algorithm
ACMer    Given N Coins, we want to build stairs rows by rows, and fill each stair with coin. The first row of stair, there is one coin, the second row 2 coins, and so on. Find out how many complete rows of... br br [[ This is a content summary only. Visit my website for full links, other content, and...
08  octobre     20h52
Teaching Kids Programming - First Number Equal or Larger Than Target using Next Function
ACMer    Given an array of numbers and a Target, we want to find out the first number that is equal or larger than the target. Linear Search O(N) time and O(1) space: class Solution: def... br br [[ This is a content summary only. Visit my website for full links, other content, and more ]]
06  octobre     21h11
Batch Script to Convert MOV Videos to MP4 MPEG using ffmpeg
ACMer    The MOV video files are generally huge compare to MP4 MPEG. When taking a video using smart phones such as iphone 12 Pro Max, you get the MOV videos. Then it starts to fill up your iphone storage as... br br [[ This is a content summary only. Visit my website for full links, other content,...
05  octobre     21h33
Teaching Kids Programming - One-way Jump Game via Backtracking, DP and Greedy Algorithm
ACMer    You are given an integer array nums. You are initially positioned at the array’s first index, and each element in the array represents your maximum jump length at that position. Return true if... br br [[ This is a content summary only. Visit my website for full links, other content,...
04  octobre     21h01
Teaching Kids Programming - Design a Hash Table
ACMer    Design a HashMap without using any built-in hash table libraries. Implement the MyHashMap class: MyHashMap() initializes the object with an empty map. void put(int key, int value) inserts a (key,... br br [[ This is a content summary only. Visit my website for full links, other content, and...
03  octobre     20h31
Teaching Kids Programming - Introduction to Hashing Function
ACMer    In Python, we have following three ways to creating a hash table: a a dict() a defaultdict(int) # value type is int The first two are equivalent: when keys do not exist in the hash table, an... br br [[ This is a content summary only. Visit my website for full links, other content,...
02  octobre     20h00
Teaching Kids Programming - Convert 1-D Array to 2D Matrix (Reshape Algorithm)
ACMer    You are given a 0-indexed 1-dimensional (1D) integer array original, and two integers, m and n. You are tasked with creating a 2-dimensional (2D) array with m rows and n columns using all the... br br [[ This is a content summary only. Visit my website for full links, other content, and more...
30  septembre     20h07
Teaching Kids Programming - Finding Real Roots of a Quadratic Equation
ACMer    Given a quadratic equation it has two real roots (which could be the same) if and only if Proof of Quadratic Equation Roots Let’s move c to the other side: And multiply both sides with 4a so we... br br [[ This is a content summary only. Visit my website for full links, other content,...
29  septembre     20h38
Teaching Kids Programming - Compute the Maximal Perimeter by Forming a Rectangle from N squares
ACMer    Given N squares which side is M, we want to re-arrange it to form a larger rectangle. We want to maximize the Perimeter. Algorithm to Compute Maximal Perimeter by Forming a Rectangle from N squares... br br [[ This is a content summary only. Visit my website for full links, other content,...