A repository of programming questions solved with dogescript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
libs
test
.gitignore
README.md
balanced_brackets.djs
beauty.djs
binary.djs
candles.djs
cards.djs
collatz.djs
compileLibs.js
distinct_counts.djs
euler8.djs
fibonacci.djs
fizzbuzz.djs
full_colors.djs
grading.djs
intersect.djs
letterchanges.djs
mingle.djs
multiply_lists.djs
nqueens.djs
package-lock.json
package.json
palindromes.djs
pascal.djs
replicator.djs
romans.djs
rotated.djs
runscript.js
spongebobify.djs
staircase.djs
super.djs
trailing.djs
writer.djs

README.md

such-interview

                        such 
                             question
                             
         interview               
    much 
    
 W
  O
   W
                  

A repository of programming interview questions solved with dogescript

These questions were pulled from the following sources:

Table of Problems

Running

All the samples in this repository can be ran via npm:

  • single-test: runs the test for the given file, eg: npm run single-test fizzbuzz.djs will run the test in test/fizzbuzz.djs
  • test: runs the whole test-suite, eg: npm test will run every .djs test file under the test directory

You'll need Node 6.x (a node that supports ECMA 6). You can check this with node -p process.versions.v8, for reference this is what I'm using:

$ node -p process.versions.v8
6.0.287.53

You can install any dependencies for this repository with npm install.

fizzbuzz

Players take turns to count incrementally, replacing any number divisible by three with the word "fizz", and any number divisible by five with the word "buzz".

View problem prompt | View Tests

fibonnacci

Please implement a function which returns the nth number in Fibonacci sequences with an input n.

View problem prompt | View Tests

palindromes

Check if a given string is a palindrome without using a built-in string.Reverse function.

View problem prompt | View Tests

collatz

The Collatz conjecture is a conjecture in mathematics named after Lothar Collatz. It concerns a sequence defined as follows: start with any positive integer n. Then each term is obtained from the previous term as follows: if the previous term is even, the next term is one half the previous term. Otherwise, the next term is 3 times the previous term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.

View problem prompt | View Tests

euler #8

The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?

View problem prompt | View Tests

distinct counts

Return distinct values and their counts (i.e. the list above becomes "1(3) 3(3) 5(2) 7(1)")

View problem prompt | View Tests

balanced brackets

Given n strings of brackets, determine whether each sequence of brackets is balanced.

View problem prompt | View Tests

beautiful strings

Given a string s, little Johnny defined the beauty of the string as the sum of the beauty of the letters in it. The beauty of each letter is an integer between 1 and 26, inclusive, and no two letters have the same beauty. Johnny doesn't care about whether letters are uppercase or lowercase, so that doesn't affect the beauty of a letter. (Uppercase 'F' is exactly as beautiful as lowercase 'f', for example.)

View problem prompt | View Tests

roman numerals

Write a program to convert a cardinal number to a Roman numeral.

View problem prompt | View Tests

rotated array

Given 2 integer arrays, determine of the 2nd array is a rotated version of the 1st array. Ex. Original Array A={1,2,3,5,6,7,8} Rotated Array B={5,6,7,8,1,2,3}

View problem prompt | View Tests

nqueens

The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, column, or diagonal. The eight queens puzzle is an example of the more general n queens problem of placing n non-attacking queens on an n×n chessboard, for which solutions exist for all natural numbers n with the exception of n=2 and n=3

View problem prompt | View Tests

The solving code is 31 source lines (the file contains some comments (starting with shh)). The board had to be passed in due to problems when loading relative libraries from libs with require and executing the test from /test.

birthday candles

Colleen is turning n years old! Therefore, she has n candles of various heights on her cake, and candle i has height(i) . Because the taller candles tower over the shorter ones, Colleen can only blow out the tallest candles. Given the for each individual candle, find and print the number of candles she can successfully blow out.

View problem prompt | View Tests

rollercoaster aka spongebobify

Print to stdout the RoLlErCoAsTeR case version of the string.

View problem prompt | View Tests

staircase

Consider a staircase of size n = 4. Observe that its base and height are both equal to n, and the image is drawn using # symbols and spaces. The last line is not preceded by any spaces. Write a program that prints a staircase of size n.

View problem prompt | View Tests

binary

Write a function that prints out the binary form of an int

View problem prompt | View Tests

grading

Given the initial value of grade for each of Sam's students, write code to automate the rounding process. For each grade(i), round it according to the rules above and print the result on a new line.

View problem prompt | View Tests

cards (real fake)

To determine which credit cards are real, double every third number starting from the first one, add them together, and then add them to those figures that were not doubled. If the total sum of all numbers is divisible by 10 without remainder, then this credit card is real.

View problem prompt | View Tests

list replication (replicator)

Given a list, repeat each element in the list n amount of times.

View problem prompt | View Tests

pascal's triangle

For a given integer K, print the first K rows of Pascal's Triangle.

View problem prompt | View Tests

set intersection

You are given two sorted list of numbers (ascending order). The lists themselves are comma delimited and the two lists are semicolon delimited. Print out the intersection of these two sets.

View problem prompt | View Tests

string mingling

You are given two strings P (Pawel's favorite) and Q (Shaka's favorite), determine the mingled string R.

View problem prompt | View Tests

trailing

There are two strings: A and B. Print 1 if string B occurs at the end of string A. Otherwise, print 0.

View problem prompt | View Tests

multiply lists

You have 2 lists of positive integers. Write a program which multiplies corresponding elements in these lists.

View problem prompt | View Tests

super digit

You are given two numbers n and k. You have to calculate the super digit of P.

View problem prompt | View Tests

letter changes

Replace every letter in the string with the letter following it in the alphabet (ie. c becomes d, z becomes a). Then capitalize every vowel in this new string (a, e, i, o, u) and finally return this modified string.

View problem prompt | View Tests

full colors

You are given a sequence of N balls in 4 colors: red, green, yellow and blue. The sequence is full of colors if and only if all of the following conditions are true: There are as many red balls as green balls. There are as many yellow balls as blue balls. Difference between the number of red balls and green balls in every prefix of the sequence is at most 1. Difference between the number of yellow balls and blue balls in every prefix of the sequence is at most 1.

View problem prompt | View Tests

This submission is 31 lines of source. Granted, I wiggled around a bit with that multi OR condition and calling counts.get() (since dogescript 2.3.0 doesn't support proper precedence, I would have had to assign each color count to a variable and used counts dose get with LETTER and that would have put me at 35 lines.)

find a writer

You have a set of rows with names of famous writers encoded inside. Each row is divided into 2 parts by pipe char (|). The first part has a writer's name. The second part is a "key" to generate a name.

View problem prompt | View Tests

traveling salesman polynomial solution

Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?

View problem prompt | View Tests