mirror of
https://gitlab.com/mfocko/CodeWars.git
synced 2024-12-22 20:31:30 +01:00
6kyu: add detect pangram
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
50425a67ea
commit
3fc8a805ef
2 changed files with 33 additions and 0 deletions
29
6kyu/detect_pangram/solution.pas
Normal file
29
6kyu/detect_pangram/solution.pas
Normal file
|
@ -0,0 +1,29 @@
|
|||
unit Kata;
|
||||
|
||||
interface
|
||||
|
||||
function IsPangram (s: string): boolean;
|
||||
|
||||
implementation
|
||||
|
||||
function IsPangram (s: string): boolean;
|
||||
var
|
||||
i: integer;
|
||||
stringSize: integer;
|
||||
letters: integer = 0;
|
||||
begin
|
||||
s := LowerCase(s);
|
||||
stringSize := Length(s);
|
||||
|
||||
for i := 1 to stringSize do
|
||||
begin
|
||||
if (s[i] < 'a') or (s[i] > 'z') then
|
||||
continue;
|
||||
|
||||
letters := letters or (1 << (Ord(s[i]) - Ord('a')));
|
||||
end;
|
||||
|
||||
IsPangram := letters = (1 << 26) - 1;
|
||||
end;
|
||||
|
||||
end.
|
|
@ -210,6 +210,10 @@
|
|||
|
||||
- [Valid Braces](https://www.codewars.com/kata/5277c8a221e209d3f6000b56) - [solution](6kyu/valid_braces)
|
||||
|
||||
### Pascal
|
||||
|
||||
- [Detect Pangram](https://www.codewars.com/kata/545cedaa9943f7fe7b000048) - [solution](6kyu/detect_pangram)
|
||||
|
||||
## 7 kyu
|
||||
|
||||
### JS
|
||||
|
|
Loading…
Reference in a new issue