2021 Christmas BiNgO
Choose a snippet. The answer is the runtime in "big O" notation.
help wanted!
This challenge is in alpha phase. Please submit me a new snippet+solution in private. The language of your own snippet does not matter.
A code snippet
GeSHi`ed PHP code for
"string_utility.php" 1
2
3
4
56
7
8
9
1011
12
13
14
1516
17
18
19
2021
22
23
24
2526
27
| <?php
namespace GDO\Util;
/**
* Please answer with "O(expr)". * @author gizmore
*/
final class Strings
{
/** * Check if a string ends with another string.
*
* @param string $s
* @param string $with
* @return boolean */
public static function endsWith($s, $with)
{
if ($length = mb_strlen($with))
{ return mb_strrpos($s, $with) === (mb_strlen($s) - $length);
}
return true;
}
}
|
© 2024 by