Skip to content

Instantly share code, notes, and snippets.

View paramire's full-sized avatar

Patricio Ramirez paramire

  • Valparaiso, Chile
View GitHub Profile
@paramire
paramire / issue_254.js
Last active July 2, 2022 23:02
LongestWord - Issue 254
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 June 20, 2022 02:39
longText - Issue 252
# -*- 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