跟随,学习,进步

Acm

The Ultimate Computer Technology Blog | The Knowledgebase of Computing

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

Implement the Depth First Search Algorithm in Graph using Simple C/C++

Given a graph represented by G(V, E) where V is the vertices and E represents the edges, we can do a Depth First Search Algorithm (DFS) on any node/vertex. The DFS will mark the current node visited... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Beginner’s Introduction to PHP Memcached

Querying the Database e.g. MySQL could be very expensive relative to just a cache which is just a key value store . And for SELECT statements, we want to cache the results to speed up the... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Using the Regular Expression to Replace External Links in WordPress for SEO purposes

Let’s say we want to put a REL=NOFOLLOW on all external links in your wordpress posts/pages, we can add a filter to parse the content using the regular expression replace function e.g.... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


5 Smart Guides In Taking The Best Hosting Provider

So you have designed your own website. What’s the next step? You need a domain and a host. Domains and domain names are relatively easy if you choose it correctly. Or, if you really want to purchase... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Checking Subtree of Another Tree using Preorder Traversal or Recursion

Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Optimize WordPress Website for Speed?

One of the main problems that website owners face is slow loading times and poor website performance which can affect website search engine ranking and lose valuable traffic. The website speed is... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Compute the Day of the Week using C++?

Given a date, return the corresponding day of the week for that date. The input is given as three integers representing the day, month and year respectively. Return the answer as one of the following... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Counting Substrings with Only One Distinct Letter with Different Algorithms

Given a string S, return the number of substrings that have only one distinct letter. Example 1: Input: S = “aaaba” Output: 8 Explanation: The substrings with one distinct letter are... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Compute the Middle of the Linked List using Fast and Slow Pointer?

Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middle node. Example 1: Input: Output: Node 3 from... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Fix eslint linebreak style error on Visual Studio Code Windows? (Expected linebreaks to be ‘crlf’ but found ‘lf’)

Suddenly, you run npm run lint and it shows quite a lot of linebreak-style errors. Your Visual Studio Code suddenly does not show you the lint errors as well. You probably run npm run lint —... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Construct the Maximum Binary Tree using Divide-and-Conquer Recursion Algorithm?

Given an integer array with no duplicates. A maximum tree building on this array is defined as follow: The root is the maximum number in the array. The left subtree is the maximum tree constructed... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Construct Binary Tree from Inorder and Postorder Traversal using Depth First Search Algorithm (Recursion)?

Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. For example, given inorder = postorder = Return the... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Flatten 2D Vector in C++?

Design and implement an iterator to flatten a 2d vector. It should support the following operations: next and hasNext. Example: Vector2D iterator = new Vector2D(,,]); iterator.next(); // return 1... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Python Method to Find the Largest Unique Number in an Array

Given an array of integers A, return the largest integer that only occurs once. If no integer occurs once, return -1. Example 1: Input: Output: 8 Explanation: The maximum integer in the array is 9... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Find the Largest Unique Number in Array using Javascript (Functional Programming)

Given an array of integers A, return the largest integer that only occurs once. If no integer occurs once, return -1. Example 1: Input: Output: 8 Explanation: The maximum integer in the array is 9... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


The Git Pre-Commit Hook to Avoid Pushing Only Unit Tests In NodeJs

In NodeJS unit testing frameworks such as mocha/chai, you could add .only after describe or it, so that the specific set of tests are run, which excludes/disables all other tests. For example,... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Find the Most Common Word in a String with a Banned List?

Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at least one word that isn’t banned, and that the... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Construct Minimum Spanning Tree using Kruskal or Breadth First Search Algorithm?

There are N cities numbered from 1 to N. You are given connections, where each connections = represents the cost to connect city1 and city2 together. (A connection is bidirectional: connecting city1... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Two Pointer and Sliding Window Algorithm to Find K-Length Substrings With No Repeated Characters

Given a string S, return the number of substrings of length K with no repeated characters. Example 1: Input: S = “havefunonleetcode”, K = 5 Output: 6 Explanation: There are 6 substrings... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Get the Maximum Level Sum of a Binary Tree using Breadth First Search Algorithm?

Given the root of a binary tree, the level of its root is 1, the level of its children is 2, and so on. Return the smallest level X such that the sum of all the values of nodes at level X is maximal.... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]