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
package main | |
import ( | |
"log" | |
"math" | |
) | |
func Round(val float64, roundOn float64, places int ) (newVal float64) { | |
var round float64 | |
pow := math.Pow(10, float64(places)) |
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
class A | |
attr_accessor :a | |
def initialize | |
@a = 100 | |
end | |
def aa | |
a = 1000 |
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
f=fs.readdirSync(".") | |
for(i=0; i<f.length; i++) {fs.renameSync(f[i], f[i].replace(/ |\'/g, "-"))} |
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
We define to be a permutation of the first natural numbers in the range . Let denote the position of in permutation (please use -based indexing). | |
is considered to be an absolute permutation if holds true for every . | |
Given and , print the lexicographically smallest absolute permutation, ; if no absolute permutation exists, print -1. | |
Input Format | |
The first line of input contains a single integer, , denoting the number of test cases. | |
Each of the subsequent lines contains space-separated integers describing the respective and values for a test case. |
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
Bob has a strange counter. At the first second, , it displays the number . At each subsequent second, the number displayed by the counter decrements by . | |
The counter counts down in cycles. In the second after the counter counts down to , the number becomes the initial number for that countdown cycle and then continues counting down from the new initial number in a new cycle. The diagram below shows the counter values for each time in the first three cycles: | |
https://s3.amazonaws.com/hr-challenge-images/22185/1469447349-bae87a5071-strange1.png | |
Given a time, , find and print the value displayed by the counter at time . | |
Input Format |
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
You are the benevolent ruler of Rankhacker Castle, and today you're distributing bread to a straight line of subjects. Each subject (where ) already has loaves of bread. | |
Times are hard and your castle's food stocks are dwindling, so you must distribute as few loaves as possible according to the following rules: | |
Every time you give a loaf of bread to some person , you must also give a loaf of bread to the person immediately in front of or behind them in the line (i.e., persons or ). | |
After all the bread is distributed, each person must have an even number of loaves. | |
Given the number of loaves already held by each citizen, find and print the minimum number of loaves you must distribute to satisfy the two rules above. If this is not possible, print NO. | |
Input Format |
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
Given a 2D array of digits, try to find the occurrence of a given 2D pattern of digits. For example, consider the following 2D matrix: | |
1234567890 | |
0987654321 | |
1111111111 | |
1111111111 | |
2222222222 | |
Assume we need to look for the following 2D pattern: | |
876543 |
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
Given the time in numerals we may convert it into words, as shown below: | |
5:00 => five o' clock | |
7:29 => twenty nine minutes past seven | |
5:01 => one minute past five | |
5:10 => ten minutes past five | |
5:30 => half past five | |
5:45 => quarter to six | |
5:47 => thirteen minutes to six |
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
class A | |
attr_accessor :a | |
def initialize | |
self.a = 100 | |
end | |
def b | |
puts @a |
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
/************************************************************************** | |
* OSM2GEO - OSM to GeoJSON converter | |
* OSM to GeoJSON converter takes in a .osm XML file as input and produces | |
* corresponding GeoJSON object. | |
* | |
* AUTHOR: P.Arunmozhi <[email protected]> | |
* DATE : 26 / Nov / 2011 | |
* LICENSE : WTFPL - Do What The Fuck You Want To Public License | |
* LICENSE URL: http://sam.zoy.org/wtfpl/ | |
* |