Блог пользователя alphastigma

Автор alphastigma, 19 месяцев назад, По-английски

You are living in the world of 2d graphs. You start at point (0,0). Your friends' house is at coordinates (10,10).You can only move either one step RIGHT or one step UP at a time. Can you find number of ways to reach your friends house?

soln

Easy?Hmm.Well the tricky(or is it?) part is, can you calculate the number of ways to reach the same destination if you have to make only even number of turns in your journey?

soln

Got asked this question in an interview, so I thought i would share it here ^_^

Полный текст и комментарии »

  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

Автор alphastigma, 19 месяцев назад, По-английски

Note that the environment i am sharing is what I made from compiling a few sources here and there. I myself was facing some difficulty being a newbie in this as I usually used just Vim, so I figured adding it here would help some people save time and brain cells

  • First, I use VSCode for coding in C++ language (You can also setup NeoVim like VSCode but there were so many good extensions available on VSCode that i shifted to this one, also let's be honest: resolving dependencies in Vim is mehh..).

  • Second, you need to get a template .cpp file ready so that you don't have to waste time on it on every problem. I will not be giving that one here, as you should look at what template suits the best for you (Start looking in code submissions from higher rated coders here and see what all they use in their templates) (: I myself forgot from which sources I stole my template file ^__^ )

  • Third, and the main reason for writing this blog, get CodeForces Programming Extension Helper (from here: https://mirror.codeforces.com/blog/entry/71386) (Codeforces is only in the name, otherwise it works on all the online judges) You can add whatever testcase you want easily and test on it. You just have to click the extension in your browser and the extension parses the question and testcases in your VSCode locally
  • Fourth, you need to learn how to use debug statements instead of cin/cout for testing. I have added the lines you will need to add in your template file to use dbg statements easily.

Debug temp code [Just last 4 lines are relevant for us mortals]


  • Fifth, you dont need to submit manually by copy pasting your code everytime on the platform's code editor (atleast in codeforces). Just setup the Codeforces command line interface tool from here: https://mirror.codeforces.com/blog/entry/66552 and with just one command you can submit your codeforces code with this API.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится