Skip to content

Instantly share code, notes, and snippets.

@mrfinch
Last active August 14, 2019 09:28
Show Gist options
  • Save mrfinch/d160fdf67f658c419285 to your computer and use it in GitHub Desktop.
Save mrfinch/d160fdf67f658c419285 to your computer and use it in GitHub Desktop.
DSL Wiki

##DSL

###Datatypes supported:
#####integer,float,string,boolean,long_integer,character

####DSL for Variables:
DSL: Datatype(name)
#####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

@jarus123
Copy link

can any one put the code stubs for tree generation plz

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