Today Leetcode problem is rotating linked list . Doing it is a no brainer( Answer below). What I suddenly realize is you could pipe the boolean expression to simplify the boolean check later on. To jump straight on:
int k1 = (l == 0 ) ? 0 : k % l;
/* equivalent to
if(l != 0 )
k1 = k % l;
else k1 = 0;
if(k1 == 0)
return head; //rotate with k multiple of list length or list empty
It is like a filter so the end result is just one simple check. I know it won’t make much of a difference but it comes to my mind naturally.
Continue reading “Cascading boolean expression”
Was browsing through Medium coding problems of Leetcode( Oh yeah. I think Im at this level ) when I stumble upon this one — validating binary tree. Pfft. You dummy, NO WAY this is medium. Turns out it is harder than I thought ^^, not because it is hard but because of my stupid mistakes….
Continue reading “Validating Binary Tree”
It’s actually not that hard…..It’s just …… verbose and time consuming. Well, let’s dive in, shall we.
Continue reading “Ajax in the Java MVC world ? How hard can it be ?”
So once in a while, I reorganized my study space because order and progress, throwing away stuff I don’t need, especially those credit card offer letter, keeping things that are important for a foreseeable future( tax files, bills, etc ) …. Less is more ( or Minimalism ):
Continue reading “The mysterious “.” files”
Since AI agent is crated for specific task, specialized environment, let’s see what problem we are trying to solve because “the first step in solving any problem is recognizing there is one”
Continue reading “[GradAI] Problem & Search”