Skip to content

Instantly share code, notes, and snippets.

View torressam333's full-sized avatar
📖
Proverbs 3:5

Samuel Torres torressam333

📖
Proverbs 3:5
View GitHub Profile
@torressam333
torressam333 / miniMaxSum.php
Created February 26, 2020 16:42
Hackerrank Mini-Max-Sum Solution
<?php
//My Solution
// Complete the miniMaxSum function below.
function miniMaxSum($arr) {
sort($arr);
for($i = 0; $i <= count($arr); $i++){
$minSum = array_sum($arr) - $arr[4];
$maxSum = array_sum($arr) - $arr[0];
@torressam333
torressam333 / PlusMinus.php
Last active November 20, 2022 13:53
HackerRank Plus Minus Solution PHP
<?php
// Complete the plusMinus function below.
function plusMinus($arr) {
//Get total index in array
$totalCount = count($arr);
//Initialize values to zero "score"
$pos = 0;
$neg = 0;
$zero = 0;