Sha256: 505ae46abb3c3c58d0a2ff0921e2ed3e394d2d3aad34fcc34b76ea721b10831b
Contents?: true
Size: 524 Bytes
Versions: 57
Compression:
Stored size: 524 Bytes
Contents
#include "isogram.h" #include <ctype.h> #include <stddef.h> #include <stdint.h> bool isIsogram(const char phrase[]) { uint32_t usedLetters = 0; if (phrase == NULL) return false; for (int16_t i = 0; phrase[i] != '\0'; ++i) { if (isalpha(phrase[i])) { uint8_t bitNumber = toupper(phrase[i]) - 'A'; uint32_t bitMask = 1 << bitNumber; if ((usedLetters & bitMask) > 0) return false; else usedLetters |= bitMask; } } return true; }
Version data entries
57 entries across 57 versions & 1 rubygems