Skip to content

Instantly share code, notes, and snippets.

Avatar

Patricio Ramirez paramire

  • Valparaiso, Chile
View GitHub Profile
@paramire
paramire / issue_254.js
Last active Jul 2, 2022
LongestWord - Issue 254
View issue_254.js
function longestWord(token, words) {
words = words.sort((a, b) => b.length - a.length);
// after sort find will be the longest
const longestWord = words.find((word) => {
let index = 0;
for (let charIndex = 0; charIndex < word.length; charIndex++) {
if (!token.slice(index).includes(word[charIndex])) {
break;
}
index = token.slice(index).indexOf(word[charIndex]);
@paramire
paramire / issue_252.py
Last active Jun 20, 2022
longText - Issue 252
View issue_252.py
# -*- coding: utf-8 -*-
import sys
import unicodedata
def is_vowel(char):
_char = unicodedata.normalize('NFKD', char)
if _char[0].lower() in 'aeiou':
return True
return False