This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env php | |
<?php | |
// Guessing game CLI app | |
$options = getopt('h::', ["min::", "max::"]); | |
if (isset($options['h'])) { | |
printf("This is a guessing game application"); | |
} else { | |
$min = (int) ($options['min'] ?? 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
//param A : string | |
//param B : string | |
//return an integer | |
solve : function(A, B){ | |
let rows = A.length, cols = B.length; | |
let lcs = Array.from({ length: rows + 1 }, () => Array.from({ length: cols + 1 }).fill(0)); | |
for (let i=1;i<=rows;i++) { | |
for (let j=1;j<=cols;j++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
//param A : array of integers | |
//param B : array of integers | |
//param C : integer | |
//return an integer | |
solve : function(A, B, C){ | |
let n = A.length; | |
let maxValue = Array.from({length: C + 1}).fill(0); | |
for (let i=1; i<=n; i++) { |
OlderNewer