diff --git "a/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/README.md" "b/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/README.md" index 40f157d355561..7a7bbda366870 100644 --- "a/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/README.md" +++ "b/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/README.md" @@ -116,6 +116,24 @@ function minCount(coins: number[]): number { } ``` +### **PHP** + +```php +class Solution { + /** + * @param Integer[] $coins + * @return Integer + */ + function minCount($coins) { + $cnt = 0; + for ($i = 0; $i < count($coins); $i++) { + $cnt += floor($coins[$i] / 2) + ($coins[$i] % 2); + } + return $cnt; + } +} +``` + ### **...** ``` diff --git "a/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/Solution.php" "b/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/Solution.php" new file mode 100644 index 0000000000000..eb3342d0efaf1 --- /dev/null +++ "b/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/Solution.php" @@ -0,0 +1,13 @@ +class Solution { + /** + * @param Integer[] $coins + * @return Integer + */ + function minCount($coins) { + $cnt = 0; + for ($i = 0; $i < count($coins); $i++) { + $cnt += floor($coins[$i] / 2) + ($coins[$i] % 2); + } + return $cnt; + } +}