— Diary, Programming, Crio.do — 2 min read
Received a mail from Crio yesterday about Winter of doing round 1. Isn't really a big deal since I don't even think they've shortlisted anyone yet. Waiting for the saturday event to learn more and see if it's as good as the hype surrounding it.
Starting Raahee work for today.
Tasks:
Worked on Raahee users collection. Damn it was crazy focusing on all the little things so much so that I became frustrated at one point. Still have to add the already registered users to the test DB, and hope it doesn't break the app.
Break!
Since I haven't been able to keep up with Go and all the other things, I am thinking about moving to Go for solving the competitive programming questions. Now, the single issue with that is I'll either have to write code in C++
, or pseudocode first and then in Go
which seems a little exhausting but I have to make that trade-off.
When I think about it, it's like learning Spanish. You can't think in Spanish, but what you can do is think in your native language and then translate to Spanish. Following the same philosophy here. :)
Writing code in C++
first.
Approach : If the difference of prev and current element contain k elements, return the kth element from prev element.
1int findKthPositive(vector<int> &arr, int k) {2 int prev = 0;3 int sum = 0;4 arr.push_back(10000);5 for (int i = 0; i < arr.size(); i++) {6 int temp = arr[i] - prev - 1;7 if (sum + temp >= k) {8 return prev + k - sum;9 }10 sum += temp;11 prev = arr[i];12 }1314 return 0;15}
Time complexity O(n), space O(1). Translating to Go now.
1func findKthPositive(arr []int, k int) int {2 var prev, sum int = 0, 03 arr = append(arr, 10000)4 5 for i := 0; i < len(arr); i++ {6 var temp int = arr[i] - prev - 17 if sum + temp >= k {8 return prev + k - sum9 } 10 sum += temp11 prev = arr[i]12 }13 14 return 0;15}
So I was thinking about writing secrets in here, and I have made a basic component that would take the password and unlock what I wrote.
Try writing parasisgreat
in the box and press enter. Oh I know you don't wanna write it but I'm a braggart!
Well you shouldn't be surprised! 😇
Amidst the glory of this, I almost forgot that I also used spell check today for rechecking all the posts.
Used markdown-spellcheck
for the task.
1npm i -g markdown-spellcheck23# -n for not including numbers4mdspell -n '**/*6*/**.mdx' '!**/node_modules/**/*.mdx'
Done with the report feature in Raahee website. Took almost 90 minutes and now I'm tired.
I have also been thinking about the best way to encrypt the data. I can go with standard encryption technique but it would be hard to actually remember the passwords for each document. Then there is an option for auto calculating password based on document slug, which would be a better approach. Also, rather than writing content here, I can just link it to firebase to fetch the content and parse the markdown which makes more sense but then my code is on GitHub. 😕
Added like feature community page. The code seems to be messed up quite a lot. The database naming scheme used by the app and website teams differ so much that I don't even have the words to express myself.
I think I'm just gonna sleep for now.
Ciao!