Tech thingies :

Pinned post: the tech corner !

Welcome to the tech corner !

Here, you'll find me rambling on and on about different tech related things I'm doing.

This includes, but is not limited to LeetCode answers, Linux things, cool things i'm doing, and more. Enjoy !

Some cool leetcode answers!

This here project that is my website was, at first, only part of me wanting to get more into coding. I've had some basic python3 experience, and wanted to develop that in parallel with learning HTML5/CSS/JS, C++ and maybe some rust.

In doing so, to sharpen my python3 skillz, I recently started doing the daily leetcode. Here are some cool/ elegant answers I got to some problems

The first one i got was this short and very time-efficient (0ms I reckon) answer to problem n°118: Pascal's Triangle.


    def generate(self, numRows: int) -> List[List[int]]:
        A = [[1] * (i + 1) for i in range(numRows)]
        for i in range(2, len(A)):
            for j in range(1, i):
                A[i][j] = A[i - 1][j - 1] + A[i - 1][j]
        return A
                    

And another would be this answer to problem 263, "Ugly Numbers", my approach being very mathematically oriented.


    def isUgly(self, n: int) -> bool:
    if n == 1 :
        return True
    if n <= 0 :
        return False 
    for k in range(n):
        if n / 2 == int(n/2) :
            n = n/2
        elif n / 5 == int(n/5):
            n/= 5
        elif n / 3 == int(n/3):
            n= n/3
        elif n == 1 :
            return True 
        else :
            return False   
                    

I'll post more as they come, but enjoy those 2 for now !