Skip to content

Instantly share code, notes, and snippets.

View tafo's full-sized avatar
🏠
Working@Home

Tayfun Yirdem tafo

🏠
Working@Home
  • World
View GitHub Profile
@tafo
tafo / functions.go
Created December 13, 2023 18:31
Why do I need to write parameter names
func main() {
ebiten.SetWindowSize(1280, 640)
ebiten.SetWindowTitle("Wordy")
if err := ebiten.RunGame(&wordy.Game{}); err != nil {
panic(err)
}
}
func (g *Game) Layout(outsideWidth int, outSideHeight int) (screenWidth int, screenHeight int) {
return ScreenWidth, ScreenHeight
public bool DetectCapitalUse(string word)
{
if (word.Length == 1) return true;
Func<char, bool> condition;
if (word[0] <= 'Z' && word[1] <= 'Z')
condition = c => c <= 'Z';
else
condition = c => c >= 'a';
public bool DetectCapitalUse(string word)
{
if (word.Length == 1) return true;
if (word[0] <= 'Z' && word[1] <= 'Z')
{
for (var i = 2; i < word.Length; i++)
{
if (word[i] <= 'Z') continue;
return false;
}
public bool DetectCapitalUse(string word)
{
var capitals = 0;
for (var i = 0; i < word.Length; i++)
{
if (char.IsUpper(word[i])) capitals++;
}
if (capitals == word.Length || capitals == 0) return true;
return capitals == 1 && char.IsUpper(word[0]);
public bool DetectCapitalUse(string word)
{
var n = word.Length;
bool match1 = true, match2 = true, match3 = true;
// case 1: All capital
for (int i = 0; i < n; i++)
{
if (!char.IsUpper(word[i]))
{
public class Solution
{
    public IList<string> WordBreak(string s, IList<string> wordDict)
    {
        var result = new List<string>();
        Trie.Alphabet = new HashSet<int>();
        var rootTrie = new Trie();
        for (var i = 0; i < wordDict.Count; i++)
        {
namespace Mathematics.Code
{
public class Number
{
public static double Power(double x, double y)
{
var result = 1.0;
var p = (int)y;
while (p != 0)
{