Given a string containing brackets []
, braces {}
, parentheses ()
,
or any combination thereof, verify that any and all pairs are matched and nested correctly.
sed -Enf parentheses.sed parentheses.txt
(message as text) as text => | |
let | |
yelling = Text.Upper(phrase) = phrase and Text.Lower(phrase) <> phrase, | |
question = Text.EndsWith(phrase, "?"), | |
phrase = Text.Trim(message) | |
in if phrase = "" then | |
"Fine. Be that way!" | |
else if yelling and question then | |
"Calm down, I know what I'm doing!" | |
else if yelling then |
IntStream ints = rangeClosed(1, 20); | |
IntPredicate fizz = i->i%3==0; | |
IntPredicate buzz = i->i%5==0; | |
IntPredicate fizzBuzz =... | |
assertThat(ints.filter(fizzBuzz)) | |
.containsExactly(4,7,8,9,13,14,19); |
#!/usr/bin/env bash | |
# | |
# Copyright (c) 2023 Jegors Čemisovs | |
# License: MIT | |
# Repository: https://github.com/rabestro/gpt4-session-to-markdown | |
# | |
# Converts GPT-4 chat session JSON data to markdown format and | |
# adds YAML front matter to the top of the file to prepare it | |
# for publishing on the Jekyll site. | |
# |
func Hey(remark string) string { | |
remark = strings.TrimSpace(remark) | |
if remark == "" { | |
return "Fine. Be that way!" | |
} | |
isQuestion := strings.HasSuffix(remark, "?") | |
isYelling := strings.ToUpper(remark) == remark && strings.ToLower(remark) != remark |
// Package bob implements a solution for the bob exercise from the Exercism Go track. | |
package bob | |
// Hey takes a message as input, and returns Bob's response to that remark. | |
func Hey(message string) string { | |
remark := newRemark(message) | |
switch { | |
case remark.isSilence(): | |
return "Fine. Be that way!" |
package bob | |
import ( | |
"strings" | |
"unicode" | |
) | |
type Remark string | |
func newRemark(remark string) Remark { |
// Package romannumerals provides methods for manipulating numbers into roman numerals | |
package romannumerals | |
import "errors" | |
type RomanNumeral struct { | |
Value int | |
Symbol string | |
} |
package com.epam.flipflop; | |
import org.junit.jupiter.api.Test; | |
import static org.junit.jupiter.api.Assertions.assertFalse; | |
import static org.junit.jupiter.api.Assertions.assertTrue; | |
import java.util.function.Predicate; | |
class CopilotTest { | |
@Test |
def word_key: ascii_downcase | explode | sort; | |
(.subject | length) as $size | | |
(.subject | ascii_downcase) as $subject | | |
(.subject | word_key) as $subject_key | | |
def is_candidate: length == $size and ascii_downcase != $subject; | |
def is_anagram: word_key == $subject_key; | |
[ |