From 0bb75d0bcb65b453f6c4b529235af8bfe592a5e6 Mon Sep 17 00:00:00 2001 From: Sarvar <56576654+sarvar-akbarov@users.noreply.github.com> Date: Sun, 2 Jul 2023 19:06:05 +0500 Subject: [PATCH] Added solution in PHP language --- solutions/033.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/solutions/033.md b/solutions/033.md index 94ef6af..aed493c 100644 --- a/solutions/033.md +++ b/solutions/033.md @@ -68,4 +68,24 @@ class Solution: return "".join([mapping[index] for index in range(len(s))]) ``` +#### PHP +```php +class Solution { + + /** + * @param String $s + * @param Integer[] $indices + * @return String + */ + function restoreString($s, $indices) { + $n = count($indices); + $mapping = $indices; + + for($i = 0; $i < $n; $i++){ + $mapping[$indices[$i]] = $s[$i]; + } + return implode('', $mapping); + } +} +``` ***NB***: If you want to get community points please suggest solutions in other languages as merge requests.