\documentclass[uplatex,dvipdfmx,12pt]{article}
\usepackage{hyperref}
\usepackage{hyperref}
\hypersetup{
colorlinks,citecolor=blue,filecolor=blue,linkcolor=blue,urlcolor=blue
}
\newcounter{mycount}
\newcommand{\qn}[1]{
\subsubsection*{
\label{sec:qn\thesection\alph{mycount}}
\hyperref[sec:an\thesection\alph{mycount}]{\thesection\alph{mycount}\quad\textit{#1}}
\stepcounter{mycount}}
}
\newcommand{\an}{
\subsubsection*{
\label{sec:an\thesection\alph{mycount}}
\hyperref[sec:qn\thesection\alph{mycount}]{\thesection\alph{mycount}}
\stepcounter{mycount}}
}
\begin{document}
\tableofcontents
\section{Test} \setcounter{mycount}{1}
\qn{Test problem}
Something.
\qn{}
Something.
\addcontentsline{toc}{subsection}{Answers and Hints}
\subsection*{Answers and Hints} \setcounter{mycount}{1}
\an
The answer of the first question.
\an
The answer of the second question.
\end{document}