Skip to content

Instantly share code, notes, and snippets.

@douglasjose
douglasjose / WordFinder.scala
Created May 30, 2020 21:47
Finds valid words in a dictionary based on all permutations of valid characters
import scala.io.Source
object WordFinder {
// All permutations of the characters in the string
def permutations(s: String): List[String] = s.toSeq.permutations.map(_.unwrap).toList
// All distinct substrings obtained by removing one character from the original string
def subsets(s: String): List[String] = {
if (s.length == 1) List(s) else {

Keybase proof

I hereby claim:

  • I am douglasjose on github.
  • I am douglasjose (https://keybase.io/douglasjose) on keybase.
  • I have a public key whose fingerprint is E01C 11EC 8375 BB13 FD22 2CAC 91D7 05ED 400F 52DF

To claim this, I am signing this object:

@douglasjose
douglasjose / CherylsBirthday.scala
Created May 2, 2015 05:42
"Cheryl's Birthday" solution in Scala, based on the solution from Peter Norvig at http://nbviewer.ipython.org/url/norvig.com/ipython/Cheryl.ipynb
package com.douglasjose.tech
/**
* "Cheryl's Birthday" solution in Scala, based on the solution from Peter Norvig at
* http://nbviewer.ipython.org/url/norvig.com/ipython/Cheryl.ipynb
*
* @author Douglas José (@douglasjose)
*/
class CherylsBirthday {