A new simple algorithm for unique ranking of

-ary sequences is presented, using a general triangle (a triangular array of integers) that includes the well-known Pascal triangle as a special case. Applying the algorithm gives a new multilevel source coding scheme for which the prefix is the Lee weight and the suffix is the ranking number. A detailed analysis of the asymptotic performance shows that the new scheme is weighted universal. The inverse enumeration algorithm for decoding is also presented, and the complexity of the algorithm increases linearly in proportion to the length of source sequences.