Kenta blog 2.0

martedì, luglio 08, 2008

Dustin Diaz Programming Brain Teaser

TEST : http://www.dustindiaz.com/programming-brain-teaser/

A solution:

arr.join("")
.replace(/(.)(\1)((\1)+)/g,'$1$1[$3]')
.split("")
.join(" ")
.replace(/\[\ /g,"<span>")
.replace(/\ \]/g,"</span>")


obviously it can be simplified, but for me that's enought ;)
Pubblicato da kentaromiura alle 11:58 AM

Nessun commento:

Posta un commento

Post più recente Post più vecchio Home page
Iscriviti a: Commenti sul post (Atom)

Archivio blog

  • ►  2014 (1)
    • ►  dicembre (1)
  • ►  2013 (1)
    • ►  novembre (1)
  • ►  2012 (1)
    • ►  novembre (1)
  • ►  2011 (3)
    • ►  ottobre (2)
    • ►  febbraio (1)
  • ►  2009 (4)
    • ►  dicembre (1)
    • ►  novembre (1)
    • ►  luglio (1)
    • ►  febbraio (1)
  • ▼  2008 (9)
    • ►  novembre (2)
    • ►  settembre (1)
    • ▼  luglio (1)
      • Dustin Diaz Programming Brain Teaser
    • ►  maggio (1)
    • ►  febbraio (1)
    • ►  gennaio (3)
  • ►  2007 (19)
    • ►  dicembre (2)
    • ►  ottobre (4)
    • ►  settembre (4)
    • ►  luglio (3)
    • ►  maggio (1)
    • ►  aprile (1)
    • ►  marzo (4)
  • ►  2006 (12)
    • ►  novembre (2)
    • ►  ottobre (2)
    • ►  agosto (1)
    • ►  luglio (2)
    • ►  maggio (2)
    • ►  aprile (3)
  • ►  2005 (12)
    • ►  dicembre (1)
    • ►  novembre (1)
    • ►  ottobre (3)
    • ►  settembre (1)
    • ►  luglio (1)
    • ►  giugno (5)

Informazioni personali

kentaromiura
Visualizza il mio profilo completo

Links

  • web reflection
if not specified otherwise license is http://creativecommons.org/licenses/by/3.0/. Tema Fantastico S.p.A.. Powered by Blogger.