//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity ^0.7.1; contract SimpleStore { function mergeArrays(uint256[] memory a, uint256[] memory b) internal pure returns (uint256[] memory result, uint256 resultLength) { (uint256 aI, uint256 bI, uint256 cI) = (0, 0, 0); uint256[] memory c = new uint256[](a.length + b.length); while (true) { if (aI == a.length && bI == b.length) { break; } else if (aI < a.length && bI < b.length && a[aI] == b[bI]) { c[cI] = a[aI]; (aI++, bI++, cI++); } else if (aI < a.length && (bI == b.length || a[aI] < b[bI])) { c[cI] = a[aI]; (aI++, cI++); } else if (bI < b.length && (aI == a.length || a[aI] > b[bI])) { c[cI] = b[bI]; (bI++, cI++); } } return (c, cI); } }
0.7.1