Dynamic Resource Allocation for Wireless Networks and Radar Systems via Deep Reinforcement Learning