This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const fs = require('fs'); | |
const path = require('path'); | |
const compile = require('./compiler'); | |
const inputDir = 'content'; | |
const outputDir = 'stage'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LongestPalindrome { | |
public static String getLongestPalindrome(final String input) { | |
int rightIndex = 0, leftIndex = 0; | |
String currentPalindrome = "", longestPalindrome = ""; | |
for (int centerIndex = 1; centerIndex < input.length() - 1; centerIndex++) { | |
leftIndex = centerIndex - 1; rightIndex = centerIndex + 1; | |
while (leftIndex >= 0 && rightIndex < input.length()) { | |
if (input.charAt(leftIndex) != input.charAt(rightIndex)) { | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class DeletionsEasy { | |
public static void main(String[] args) { | |
String in = parseLine(); | |
int count = deletionGame(in); | |
System.out.println(count); | |
} | |
static String parseLine() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add these lines to the top of your main method to make the key listener work | |
//implement the variable listener however you want, this anonymous one is just a sample | |
KeyListener listener = new KeyListener() { | |
@Override | |
public void keyPressed(KeyEvent e) { | |
//using e.getChar() is not always a reliable way to find out what key is pressed | |
//I think you're supposed to use e.getKeyCode which will return an int representing a VK_ (virtual key) value | |
System.out.println("pressed " + e.getKeyChar()); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2016 MovingBlocks | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |