Skip to content

Instantly share code, notes, and snippets.

@abhiranjankumar00
Forked from mrfinch/dslwiki.md
Last active June 14, 2017 06:04
Show Gist options
  • Save abhiranjankumar00/be015b070b07e7e3a5175dea65e52c51 to your computer and use it in GitHub Desktop.
Save abhiranjankumar00/be015b070b07e7e3a5175dea65e52c51 to your computer and use it in GitHub Desktop.
DSL Wiki

DSL

Datatypes supported:

  • Integer: integer
  • Float: float
  • String: string
  • Boolean: boolean
  • Long Integer: long_integer
  • Character: character

DSL for Variables:

Syntax

  • For datatype x: DSL: Datatype(name)

Samples

Example:
  1. integer(a);
  2. integer(n) integer(k)

DSL for Number of test cases:

DSL:
loop(name)
{some code}
endloop

Example:

integer(t)
loop(t)
{code}
endloop

DSL for Array

DSL: Array(Datatype,name,size,type)
where type={single or multi}

Example:
  1. Array(integer,a,n,single)
  2. Array(float,b,m,multi)

DSL for 2DArray

DSL: 2DArray(Datatype,name,size1,size2)
#####Example:
2DArray(integer,a,n,m)

DSL for Start coding

DSL: #StartCode
(This will generate a comment in different languages that user can start coding from here)
Example output of #StartCode:

  1. C: //your code goes here
  2. Python: #your code goes here

Examples of DSL from various problems:

https://www.hackerrank.com/challenges/mark-and-toys
integer(n) integer(k)
Array(integer,a,n,single)

https://www.hackerrank.com/challenges/two-arrays
integer(t)
loop(t)
integer(n) integer(k)
Array(integer,a,n,single)
endloop

https://www.hackerrank.com/challenges/flowers
integer(n) integer(k)
Array(integer,a,n,single)

https://www.hackerrank.com/challenges/tree-pruning
integer(n) integer(k)
Array(integer,a,n,single)
2DArray(integer,edges,n-1,2)

https://www.hackerrank.com/challenges/stockmax
integer(t)
loop(t)
integer(n)
Array(integer,a,n,single)
endloop

https://www.hackerrank.com/challenges/cavity-map
integer(n) 2DArray(character,grid,n,n+1)

https://www.hackerrank.com/challenges/service-lane
integer(n) integer(t)
Array(integer,a,n,single)
loop(t)
integer(i) integer(j)
endloop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment