MCPcopy Create free account
hub / github.com/Ainevsia/Leetcode-Rust / pow

Method pow

49. Group Anagrams/Solution.cpp:54–62  ·  view source on GitHub ↗

O(1)

Source from the content-addressed store, hash-verified

52
53 // O(1)
54 unsigned long pow(unsigned long x, unsigned int y) {
55 // bitwise traverse y
56 unsigned long res = 1;
57 for (int offset = sizeof(int) * 8 - 1; offset >= 0; offset --) {
58 res *= res; // right shift
59 if (y & (1 << offset)) res *= x;
60 }
61 return res;
62 }
63};
64
65int main() {

Callers 4

sorted_squaresMethod · 0.45
square_sumMethod · 0.45
crack_safeMethod · 0.45
num_decodingsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected