Skip to content

Instantly share code, notes, and snippets.

View hminaya's full-sized avatar
🎯
Focusing

Hector Minaya hminaya

🎯
Focusing
View GitHub Profile
@hminaya
hminaya / capicua2.py
Last active December 16, 2015 18:59 — forked from imiric/capicua2.py
#!/usr/bin/env python
def is_palindrome(num):
return str(num) == str(num)[::-1]
def closest_higher(target, collection) :
"""Return the closest number to `target` in `collection`
that is higher than `target`"""
return max((target - i, i) for i in collection if (target - i) < 0)[1]
@hminaya
hminaya / pal.cs
Last active December 17, 2015 10:09 — forked from jose-gomez/gist:5495370
namespace PalindromeGist
{
struct Program
{
public static bool Espalindromo(string word)
{
char[] origin = word.ToCharArray();
for (int i = 0; i < word.Length; i++)
{
if (origin[i] != origin[(origin.Length - 1) - i])