跟随,学习,进步

Acm

The Ultimate Computer Technology Blog | The Knowledgebase of Computing

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

A Microsoft Coding Interview Screening for Position Principal Software Engineer

A while ago, I was applying a job (Principal Software Engineer) for Microsoft, in Cambridge the Microsoft Research Center. Big IT giants have their own Recruitment teams, and I was contacted by one... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


The Brace Expansion Algorithms using Breadth First Search or Depth First Search

A string S represents a list of words. Each letter in the word has 1 or more options. If there is one option, the letter is represented as is. If there is more than one option, then curly braces... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Coding Exercise: Sum of Digits in the Minimum Number

Given an array A of positive integers, let S be the sum of the digits of the minimal element of A. Return 0 if S is odd, otherwise return 1. Example 1: Input: Output: 0 Explanation: The minimal... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Javascript Coding Exercise: The QuickSort Implementation in Javascript

Given an array of integers nums, sort the array in ascending order. Example 1: Input: Output: Example 2: Input: Output: Note: 1 <= A.length <= 10000 -50000 <= A <= 50000 Relevant... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


In-place Run-Length String Compressions using C++

Given an array of characters, compress it in-place. The length after compression must always be smaller than or equal to the original array. Every element of the array should be a character (not int)... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Algorithms to Compute the Factor Combinations for An Integer using DFS and BFS

Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer n and return all possible combinations of its factors. Note: You may... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Design a High Performance/Scalable Hit Counter Class?

Design a hit counter which counts the number of hits received in the past 5 minutes. Each function accepts a timestamp parameter (in seconds granularity) and you may assume that calls are being made... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Finding Out Which Content Is Unacceptable For Your Website

Memorable domain name? Check. Really cool color scheme and navigation? Check. Content that your audience loves? Uh-oh. No worries this is where most website owners go wrong. They slave away on... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Depth First Search to Compute the Permutation with Duplicates: Letter Tile Possibilities

You have a set of tiles, where each tile has one letter tiles printed on it. Return the number of possible non-empty sequences of letters you can make. Example 1: Input: “AAB” Output: 8... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Design a Container with O(1) Add, Remove and GetRandomElement

Task: Design a Data Structure (Container) that supports O(1) constant time in Adding, Removing and Getting a Random Element with Equal Probability. For example: // RandomDS.add(3) // RandomDS.add(4)... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Algorithms to Count Subarray (Contiguous) Sum That Equals k

Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums = , k = 2 Output: 2 Note: The length of the array... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Algorithms to Find the Missing Element in Sorted Array

Given a sorted array A of unique numbers, find the K-th missing number starting from the leftmost number of the array. Example 1: Input: A = , K = 1 Output: 5 Explanation: The first missing number is... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Print Strings Right Justified – in a Rectangular Frame

Task: Write a function that takes a list of strings and prints them, one per line, right justified, in a rectangular frame. For example the list gets printed as: ********* * Hello * * World * * in *... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


WordPress Membership Plugin

Are you looking to monetize a content website? The membership model is the perfect way to do so. It can help you monetize content without resorting to ads. The number of memberships plugins available... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Algorithms to Find the Three Numbers in Array that Sum up to Zero (3Sum)

Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. The solution set must not contain... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Trim a Binary Search Tree using Depth First Search Algorithm (Recursion)?

Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in (R >= L). You might need to change the root of the tree, so the result... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Algorithm to Decode Run-Length Compression String

Given an encoded string, return it’s decoded string. The encoding rule is: k, where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guaranteed to... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


How to Find the Vertical Order Traversal of a Binary Tree using DFS Algorithm?

Given a binary tree, return the vertical order traversal of its nodes values. For each node at position (X, Y), its left and right children respectively will be at positions (X-1, Y-1) and (X+1,... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Using BackTracking Algorithm to Find the Combination Integer Sum

Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target. The same... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Algorithms to Find Maximum Size Subarray (Contiguous) Sum That Equals k

Given an array nums and a target value k, find the maximum length of a Contiguous subarray that sums to k. If there isn’t one, return 0 instead. The sum of the entire nums array is guaranteed... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]