Skip to content

Instantly share code, notes, and snippets.

View aldiunanto's full-sized avatar

Aldi Unanto aldiunanto

View GitHub Profile
@aldiunanto
aldiunanto / question_1.php
Created September 22, 2019 13:05
Get combination from given array and string
<?php
function getStringCombination($word, $dict)
{
$result = [];
if (empty($word)) {
return $result;
}
foreach ($dict as $index => $str) {
@aldiunanto
aldiunanto / question_3.php
Created September 22, 2019 09:36
Find anagram from given array
<?php
function findAnagrams($dict)
{
$anagrams = [];
$_sortString = function ($str) {
$l = str_split($str);
sort($l);
return implode('', $l);