Sha256: 9357a4d797844c1cadda13e33da56b272ffa490dbcc837c8a9298afe0cc91a9a

Contents?: true

Size: 533 Bytes

Versions: 136

Compression:

Stored size: 533 Bytes

Contents

#include "isogram.h"
#include <ctype.h>
#include <stddef.h>
#include <stdint.h>

bool is_isogram(const char phrase[])
{
   uint32_t used_letters = 0;

   if (phrase == NULL)
      return false;

   for (int16_t i = 0; phrase[i] != '\0'; ++i) {
      if (isalpha(phrase[i])) {
         uint8_t bit_number = toupper(phrase[i]) - 'A';
         uint32_t bit_mask = 1 << bit_number;

         if ((used_letters & bit_mask) > 0)
            return false;
         else
            used_letters |= bit_mask;
      }
   }

   return true;
}

Version data entries

136 entries across 136 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.97 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.96 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.95 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.94 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.93 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.92 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.91 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.90 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.89 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.88 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.87 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.86 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.85 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.84 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.83 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.82 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.81 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.80 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.79 tracks/c/exercises/isogram/src/example.c