Given an array, we want to shuffle it (to make it random), so that every possible random solution gets evenly-distributely possibility. One may quickly write a solution like this, …
Suppose you have written a few Javascript (NodeJS) unit tests using Mocha and Chai. You can run a specified set of unit tests by using mocha command. The first …
Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to intersect at node …
S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sorted in some custom order previously. We want to permute …
A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules: For 1-byte character, the first bit is a 0, followed by its …
Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are counted as different substrings …