Skip to content

Instantly share code, notes, and snippets.

View Lakshanz's full-sized avatar

Lakshan Jayathilaka Lakshanz

View GitHub Profile
@Lakshanz
Lakshanz / Problem.md
Created August 21, 2019 10:12
Google Codejam Problem A. Even Digits Answer in PHP | https://code.google.com/codejam/contest/9234486/dashboard

Supervin has a unique calculator. This calculator only has a display, a plus button, and a minus button. Currently, the integer N is displayed on the calculator display.

Pressing the plus button increases the current number displayed on the calculator display by 1. Similarly, pressing the minus button decreases the current number displayed on the calculator display by 1. The calculator does not display any leading zeros. For example, if 100 is displayed on the calculator display, pressing the minus button once will cause the calculator to display 99.

Supervin does not like odd digits, because he thinks they are "odd". Therefore, he wants to display an integer with only even digits in its decimal representation, using only the calculator buttons. Since the calculator is a bit old and the buttons are hard to press, he wants to use a minimal number of button presses.

Please help Supervin to determine the minimum number of button presses to make the calculator display an integer with no odd digits.

Input Th

@Lakshanz
Lakshanz / limit-tc.sh
Last active August 3, 2024 05:47
TC limiting : Helps to set maximum upload/download speed limit to your linux server/pc's selected network interface.
#!/bin/bash
# Full path to tc binary
TC=$(which tc)
#
# NETWORK CONFIGURATION
# interface - name of your interface device
# interface_speed - speed in mbit of your $interface
# ip - IP address of your server, change this if you don't want to use