A Novel Approach for Solving Nonsmooth Optimization Problems with Application to Nonsmooth Equations