
About me
I have a passion to solve problems, I like to be challenged and i like it even better when I manage to overcome it, that can definitely make my day. I’ve been thinking about sharing some of my work for quite some time now and finally i have decided to actually spend the time and share some of my solutions and ideas with the community.
Easy logging rxjs
import {Observable} from ‘rxjs’; import {tap} from ‘rxjs/operators’; export enum RxJsLoggingLevel { TRACE, DEBUG, INFO, WARN, ERROR } let rxjsLoggingLevel = RxJsLoggingLevel.TRACE; export function setRxJsLoggingLevel(level:
The pitfall in using weak referenced delegations for observer pattern
As Android and Java expert, recently I have came across a very nice iOS implementation for the observer pattern that exploits swift’s ARC to automatically “remove” the
Lowest Common Ancestor of a Binary Tree
class Solution { public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if (root==null || root==p || root==q) return root; TreeNode left = lowestCommonAncestor(root.left,p,q); TreeNode
Making A Large Island
class Solution { public int largestIsland(int[][] grid) { if (grid.length==0) return 0; Map map = mapIslands(grid); int max = map.values().stream().reduce(Integer::max).get(); for (int i = 0;
Best Time to Buy and Sell Stock with K transaction
The original question can be found here. Lets start from an elegant the solution : class Solution { public int maxProfit(int k,int[] prices) { if
Debouncing a function
I will start with a very common use case – say we have events that occurs a lot and in random, sometimes small intervals and