跟随,学习,进步

Acm

The Ultimate Computer Technology Blog | The Knowledgebase of Computing

https://helloacm.com/
转到作者网站

Microbit Programming: Introduction to AI – Letting Computer Play the Game

Last week, we present a apple-catching game in Microbit: Microbit Programming: How to Make a Catching-Apple Game by Using Sprites Objects? And my sons were fond of playing such, with the top score... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Subtract the Product and Sum of Digits of an Integer

Given an integer number n, return the difference between the product of its digits and the sum of its digits. Example 1: Input: n = 234 Output: 15 Explanation: Product of digits = 2 * 3 * 4 = 24 Sum... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Leetcode’s Online Code Debugger

Leetcode online judge has introduced a new feature lately – which is the online code debugger. This works perfect for me as I am using iPad + bluetooth keyboard to solve the puzzles and all I... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Algorithm to Remove a Interval from Segments

Given a sorted list of disjoint intervals, each interval intervals = represents the set of real numbers x such that a <= x < b. We remove the intersections between any interval in intervals... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Algorithm to Find the Winner on a Tic Tac Toe Game

Tic-tac-toe is played by two players A and B on a 3 x 3 grid. Here are the rules of Tic-Tac-Toe: Players take turns placing characters into empty squares (” “). The first player A always... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


The PUSHD/POPD Implementation in Pure Windows Batch

PUSHD/POPD is a great pair of tools that exist in modern operating system e.g. Windows, Linux or MAC. It allows you to jump forward and backwards between directories. The pushd takes a directory,... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Three ways to Reverse a List/Array/Tuple in Python

Reversing a List/Array is very commonly needed and there are three ways to reverse a list or array in Python. Using the .reverse() method to reverse a list or array Note: this method does not work... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Compute the Interval List Intersections using Two Pointer Algorithms?

Given two lists of closed intervals, each list of intervals is pairwise disjoint and in sorted order. Return the intersection of these two interval lists. (Formally, a closed interval (with a <=... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Summary Ranges using O(N) Two Pointer Algorithm?

Given a sorted integer array without duplicates, return the summary of its ranges. Example 1: Input: Output: Explanation: 0,1,2 form a continuous range; 4,5 form a continuous range. Example 2:... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Microbit Programming: How to Make a Catching-Apple Game by Using Sprites Objects?

Last week, we talked about the LED pixels. And by using the knowledge we have learned so far, we can make a pixel running on the Microbit’s LED. Last week, the pixel is running from the first... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


The enumerate method in Magik Programming

The Magik programming does not have an inherent enumerate method like Python, however, it would be trivial to make one: _global enumerate << _iter _proc@enumerate(list) _local i << 0... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Add Two Numbers by Two Linked List (most significant digit comes first)

ou are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


The enumerate function in Javascript

In Python, the enumerate function is an iterator that returns/yield each time a tuple that contains an index (starting from 0 and incrementing) and the element in the list. In Javascript, we can... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Check If Word Is Valid After Substitutions using Stack or Recursion?

We are given that the string “abc” is valid. From any valid string V, we may split V into two pieces X and Y such that X + Y (X concatenated with Y) is equal to V. (X or Y may be empty.)... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


The Contiguous Binary Array with Equal Numbers of Ones and Zeros

Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Example 1: Input: Output: 2 Explanation: is the longest contiguous subarray with equal number of... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Microbit Programming: Showing a Running Pixel on the LED

Last week, we talked about the loops (for and while), this week, we’ll learn the basics of the LED screen of the Microbit. Basics of LED The LED is a tiny ‘screen’ that Microbit... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Print Immutable Linked List in Reverse using Recursion or Stack?

You are given an immutable linked list, print out all values of each node in reverse with the help of the following interface: ImmutableListNode: An interface of immutable linked list, you are given... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


The Most Useful Tools for Reverse Phone Lookup

Getting calls from people you don’t know can be infuriating and annoying. You never get to know whether it is your old friend, your son’s music teacher from 5 years ago, cold-call marketers, or... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Solve the WIFI (Wireless Networks) Intermittency Issues?

If you experience WIFI (Wireless Networks) Intermittency issue, then keep reading below. The Intermittency issue means that your devices (smartphones, or laptops) occasionally lose the wireless... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Reverse a Linked List in Javascript?

Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->->->2->1->NULL Follow up: A linked list can be reversed either iteratively or... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]