— Diary, Programming — 2 min read
Starting the day a little early than usual, but I am not really sure if I can get work done during daylight. Need to work on a bug that is causing the snackbar to show "invalid hook call". I'm pretty sure that has to do with reckless code adding without testing.
Yup, made a Higher Order Component to wrap the Add Event Component and called the hook there, passed the enqueueSnackbar
down from there! React++ 😉
1import React from 'react';2import { useSnackbar } from 'notistack';34const withSnackbar = (Component) => (props) => {5 const { enqueueSnackbar } = useSnackbar();6 return (7 <Component {...props} enqueueSnackbar={enqueueSnackbar} />8 );9};1011export default withSnackbar;
This feels good!
Break;
After a long power cut, and significantly behind schedule, I'm back. First things first, trying to solve the 4th question BILLRD in Long Challenge.
Wow squares do help with collision. The trick? Well there can only be a maximum of 4 collisions no matter what. The Link to solution is 41071146.
Time to complete the Raahee reported content feature.
After an hour of overcoming the UI hurdles, I have a somewhat respectable UI for the cards and the details are being displayed properly. The only thing left is to wait for the action list.
Have been banging my head around the 5th problem on Codechef for a while now and I can't seem to get it. From what I gather, it's like the normal coin change problem but with same amount twice. Guess I'll have to go back to basics.
Well, on the Leetcode side, I completed the challenge Day 2 pretty quickly today. Had to find the corresponding nodes in a cloned tree, so it wasn't really difficult.
1TreeNode *getTargetCopy(TreeNode *original, TreeNode *cloned, TreeNode *target) {2 if (original == NULL)3 return NULL;45 if (original == target) {6 return cloned;7 }89 TreeNode *left = getTargetCopy(original->left, cloned->left, target);1011 if (left != NULL) {12 return left;13 }1415 TreeNode *right = getTargetCopy(original->right, cloned->right, target);1617 if (right != NULL) {18 return right;19 }2021 return NULL;22}
Time complexity is O(n) where n is the number of nodes. Space complexity is O(n) if the tree is like a linked list.
I need a break!
Completely done with the Reported Content feature. Working alright! Used Material UI Snackbar notistack
to create prompts. Looks awesome 👏
I also realized out that notistack already contains the withSnackbar. Bummer I mean, but at least I made it myself. I mean a lot of things are already coded, doesn't mean you can find them when you want.
Starting today's GoRoutine!
Aim : Creating a module and calling it from other module, helps in package publishing I guess. Following documentation.
Caveats with Go
It's 21:33 and I couldn't be any more tired, the day ends here. Could've been better but I'm satisfied with today.