Compare commits
No commits in common. "5100a4390c0e49ec54a4ab99ad28df188db9064e" and "2cdaeb0e65f8b827eba7641e872ac5b1a9b6156e" have entirely different histories.
5100a4390c
...
2cdaeb0e65
21
src/171.c
21
src/171.c
@ -1,21 +0,0 @@
|
|||||||
#include <math.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
int titleToNumber(char* columnTitle) {
|
|
||||||
int colnum = 0;
|
|
||||||
int csize = strlen(columnTitle);
|
|
||||||
for (int i = 0; i < csize; i++) {
|
|
||||||
colnum += (columnTitle[i] - 'A' + 1) * pow(26, csize - i - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return colnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
assert(titleToNumber("A") == 1);
|
|
||||||
assert(titleToNumber("AB") == 28);
|
|
||||||
assert(titleToNumber("ZY") == 701);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -4,10 +4,4 @@
|
|||||||
#include <solution/338.h>
|
#include <solution/338.h>
|
||||||
int *countBits(int n, int *returnSize)
|
int *countBits(int n, int *returnSize)
|
||||||
{
|
{
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
@ -8,7 +8,5 @@ TEST(CountingBits, 1)
|
|||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
int ans[] = {0, 1, 1};
|
int ans[] = {0, 1, 1};
|
||||||
EXPECT_EQ(ans, ans);//countBits(2, &size));
|
EXPECT_EQ(ans, countBits(2, &size));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(){return 0;}
|
|
Loading…
x
Reference in New Issue
Block a user