PHP

Leetcode – Robot Return To Origin Problem: Solution in Javascript and PHP

Robot Return To Origin Problem: Solution in Javascript and PHP

  Question There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes its moves. The move sequence is represented by a string, and the character moves[i] represents its ith move. Valid moves are R …

Robot Return To Origin Problem: Solution in Javascript and PHP Read More »

The Longest Common Prefix Amongst An Array of Strings – Implementation in Javascript and PHP

Today, we’ll take a look at another easy problem on leetcode, finding the longest common prefix string amongst an array of strings. Question Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”. Example 1: Input: [“flower”,”flow”,”flight”] Output: “fl” Example …

The Longest Common Prefix Amongst An Array of Strings – Implementation in Javascript and PHP Read More »