Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am arthurtaborda on github.
  • I am arthurtaborda (https://keybase.io/arthurtaborda) on keybase.
  • I have a public key ASAqLW1pPesiucHn6w3J9kyr7EwkfsyVQ69kEPCsJyzm3wo

To claim this, I am signing this object:

Given the set of all 4 letter words in the English language find the smallest
number of transformations needed to turn a 4 letter word of the set (source)
into another 4 letter word within the same set (target).
A transformation is defined as a change of a single letter in the original word that produces a valid word in the given set.
transformations("POOL","SAGE") => smallest # of transformations (positive int)
fun ladderLength(beginWord: String, endWord: String, wordList: Set<String>): Int {
if (!wordList.contains(endWord)) return 0
version: '3'
services:
postgres:
image: postgres:13.2-alpine
environment:
POSTGRES_USER: codeal
POSTGRES_PASSWORD: password
POSTGRES_DB: codeal
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/01-init.sql
create table if not exists customer(
id varchar(50) primary key,
first_name varchar(50),
last_name varchar(50),
email varchar(50),
created_at timestamp not null default now()
)
plugins {
id("com.avast.gradle.docker-compose") version "0.14.0"
}
dockerCompose {
useComposeFiles.add("src/test/resources/docker-compose.yaml")
isRequiredBy(tasks.test)
}
tasks.test {
doFirst {
// expose the port as env variable POSTGRES_TCP_5432
dockerCompose.exposeAsEnvironment(this@test)
// or
// expose the port as system property postgres.tcp.5432
dockerCompose.exposeAsSystemProperties(this@test)
}
dockerCompose {
isStopContainers = false
}
allprojects {
afterEvaluate {
def dcExt = getExtensions().findByName('dockerCompose')
if (dcExt && dcExt.hasProperty('stopContainers')) {
dcExt.stopContainers = false
logger.info("'stopContainers' property of 'dockerCompose' extension set to 'false' from 'init.gradle' script")
}
}
}