hw1: If the suits are represented by 1-4, then all five cards have the same suit can be checked easily with Suithand[1]==SuitHand[5] after ordering them.
If the denominations are represented by 1-13, then a full house can be checked easily as seen in the routine.
hw1a: this is a "vectorized" version of hw1, eliminating loops tends make programs run much faster. Because the probabilities we are trying to find are very small and we want them to two digits of precision, we need to run the simulation many many times. Using very large matrices is also not a good idea becasue to memory issues, so we can do a mix of matrix and loop. In hw1a I use a matrix with n=10000 rows, and then repeat this M=100 times for a total of one million runs. Keeping track of the intermediate steps also allows us to see that we have indeed achieved the desired precison.
Of course, we really don't need simualtion for this we can just calculate the exact answers: