How to get the node at the top corner of the cell in the table with borders and does not mess with the alignment of the empty cell in a table?
\documentclass[12pt]{standalone}
\usepackage{tikz}
\usepackage{array}
\begin{document}
\begin{tabular}{|c|c|c|c|c}\cline{1-4}
20 \raisebox{0.2cm}{\small 4} & \raisebox{0.2cm}{\small 6} & \raisebox{0.2cm}{\small 8} & \raisebox{0.2cm}{\small 8} & 40\\
\cline{1-4}
& & & & 60\\ \cline{1-4}
& & & & 50 \\ \cline{1-4}
\multicolumn{1}{c}{20} & \multicolumn{1}{c}{30} & \multicolumn{1}{c}{50} & \multicolumn{1}{c}{50} &
150\\
\end{tabular}

