Expected primary expression before ‘unsigned’ solution

statement result += unsigned int(1) < < i; can be compiled and run locally, but a compilation error appears after uploading to LeetCode: expected primary-expression before ‘unsigned’.
analysis:
statement is too complex, the compiler on LeetCode can not fully compile, need to add the basic expression.
solution:
1 for unsigned int add parentheses: (unsigned int).
2 add intermediate variable unsigned int one = 1; result += one < < I .

Read More: