Output 9876543210 without using numbers
Hi, Community!
Last weekend we held the Final of InterSystems Contest on InterSystems Caché and DeepSee as a part of IT Planet Student Championship in Sochi. BTW, this year we had about 2 000 participants in InterSystems Contest.
One of the tasks for the finals was to solve the following with Caché ObjectScript and use the minimum code.
Problem description
Write a method that would return the string 9876543210, however cls code should not contain numbers 0-9.
The goal is to write the shortest method.
Here's a method signature (it can't be modified):
ClassMethod main() As %StringAnd call sample:
USER>write ##class(ITPlanet.Task2).main() 9876543210
Also, here's the code to check your result's length:
ClassMethod length(class = {$classname()}, method = "main") As %Integer
{
#dim methodObj As %Dictionary.MethodDefinition
set methodObj = ##class(%Dictionary.MethodDefinition).IDKEYOpen(class, method)
quit methodObj.Implementation.Size
}
The best result was 25.
What's yours? ;)