Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitscript authored Sep 25, 2022
1 parent 57f6392 commit 1b33853
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 13Day-reverseArray.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;

contract Day1 {
//Create a function reverseArray(array, length of array) . This reverseArray() will take two arguments - a dynamic uint type array and length of the array.
//The reverseArray() will reverse the array.
function reverseArray(uint256[] memory arr, uint256 len)
public
pure
returns (uint256[] memory)
{
uint256 temp;
for (uint256 i = 0; i < len / 2; i++) {
temp = arr[i];
arr[i] = arr[len - i - 1];
arr[len - i - 1] = temp;
}
return arr;
}
}

0 comments on commit 1b33853

Please sign in to comment.