Classes More Than 5 Students

https://leetcode.com/submissions/detail/215940747/

Your runtime beats 97.53 % of mysql submissions.

LeetCode 12/8/2019
# Write your MySQL query statement below
SELECT class FROM (SELECT DISTINCT student, class FROM courses) as pplz
GROUP BY class
HAVING Count(student) >= 5

Rank Scores

https://leetcode.com/submissions/detail/215945996/

Your runtime beats 39.28 % of mssql submissions.

LeetCode
/* Write your T-SQL query statement below */
SELECT a.Score, b.row as 'Rank' FROM Scores AS a
LEFT JOIN 
(
SELECT ROW_NUMBER() OVER(ORDER BY Score DESC) AS 'row', Score FROM 
    (SELECT DISTINCT Score FROM Scores) AS c
) AS b
ON a.Score = b.Score
ORDER BY Score Desc

Reverse Integer

Solution

Runtime: 0 ms, faster than 100.00% of PHP online submissions for Reverse Integer.
Memory Usage: 15 MB, less than 10.00% of PHP online submissions for Reverse Integer.

LeetCode
class Solution {

    /**
     * @param Integer $x
     * @return Integer
     */
    function reverse($x) {
        if($x>0){
            $out = (int)strrev($x);
            if($out >= 2147483647)
                return 0;
        }
        else{
            $out = (int)("-".str_replace('-','',strrev($x)));
            if($out <= -2147483647)
                return 0;
        }
        return $out;
    }
}

Bulls and Cows

leetcode.com/problems/bulls-and-cows/#.Xe2cloXJwuc.link

Runtime: 8 ms, faster than 100.00% of PHP online submissions for Bulls and Cows.
Memory Usage: 15 MB, less than 100.00% of PHP online submissions for Bulls and Cows.

class Solution {

    /**
     * @param String $secret
     * @param String $guess
     * @return String
     */
    function getHint($secret, $guess) {
        $A = 0;
        for($i = 0; $i < strlen($secret); $i++){
            if($secret[$i] == $guess[$i]){
                $A++;
                $secret[$i] = "A";
                $guess[$i] = "X";
            }
        }
        $B = 0;
        for($i = 0; $i < strlen($secret); $i++){
            if(strpos($secret, $guess[$i]) !== false){
                $B++;
                $secret[strpos($secret, $guess[$i])] = "B";
            }
        }
        return $A."A".$B."B";
    }
}

Base64 Image Decoder



Error: Unable to convert base64 to image

Un-Designing

Elon Musk, in the Starship announcement, talked a little about un-designing in response to an interviewers question.

“How did you go so fast?” asked the interviewer.

Umm, well; I have this mantra called “If the schedule is long it’s wrong. If it’s tight it’s right.”

Yeah, and basically just go recursive improvement on schedule and said with feedback loop “Did this make it go faster?” Ok. If it didn’t we’re going to need to fix it. If the design takes a long time to build, it’s the wrong design. This is the fundamental thing. Over and over it’s like the tendency is to complicate things. 
I have another thing which is: “The best part is no part, the best process is no process.” It weighs nothing, costs nothing, can’t go wrong. So as obvious as that sounds: “The best part is no part.” The thing that I am most impressed with in when I have the design meetings at SpaceX is what did you Un-Design? Un-Designing is the best thing. Just delete it. That’s the best thing. Yeah.

Elon Musk, 2019

Is Un-Designing scope-creep in reverse?

Distilling the purpose of a project to its core. Eliminating extraneous expectations. On every iteration.

How do you justify simply deprecating a feature because it is fragile, expensive and underutilized? Where do you draw the line and how do you inform your customers?

On a rocket, the bar to meet is tactile and directly related to vehicle safety and reliability.
In software, there are more competing stakeholders.