Monday, 31 August 2020

Final Destination Hacker Earth Solution in C

 https://www.hackerearth.com/practice/basic-programming/implementation/basics-of-implementation/practice-problems/algorithm/final-destination-cakewalk/submissions/


#include<stdio.h>
#include<string.h>
int main()
{
char str[1000000];
scanf(" %s", str);
    int i,x=0,y=0;
    for(i=0;str[i]!='\0';i++)
{
if(str[i] == 'L')
x=x-1;
if(str[i] == 'D')
y=y-1;
if(str[i] == 'R')
x=x+1;
if(str[i] == 'U')
y=y+1;
}
printf("%d %d",x,y);
}

1 comment:

  1. As a growing business, you may find the need for additional storage for your critical then comes the question of outsourcing or constructing more visit windzr.com
    https://www.windzr.com/blog/4-things-to-consider-when-making-a-datacenter-outsourcing-decision

    ReplyDelete