The Fermi Large Area Telescope (LAT) observed two bright X-class solar flares on 2012 March 7, and detected gamma-rays up to 4 GeV. We detected gamma-rays both during the impulsive and temporally-extended emission phases, with emission above 100 MeV lasting for approximately 20 hours. Accurate localization of the gamma-ray production site(s) coincide with the solar active region from which X-ray emissions associated with these flares originated. Our analysis of the >100 MeV gamma-ray emission shows a relatively rapid monotonic decrease in flux during the first hour of the impulsive phase, and a much slower, almost monotonic decrease in flux for the next 20 hours. The spectra can be adequately described by a power law with a high energy exponential cutoff, or as resulting from the decay of neutral pions produced by accelerated protons and ions with an isotropic power-law energy distribution. The required proton spectrum has a number index ~3, with minor variations during the impulsive phase, while during the temporally extended phase the spectrum softens monotonically, starting with index ~4. The >30 MeV proton flux and spectra observed near the Earth by the GOES satellites also show a monotonic flux decrease and spectral softening during the extended phase, but with a harder spectrum, with index ~3. Based on the Fermi-LAT and GOES observations of the flux and spectral evolution of these bright flares, we explore the relative merits of prompt and continuous acceleration scenarios, hadronic and leptonic emission processes, and acceleration at the solar corona by the fast Coronal Mass Ejections (CME) as explanations for the observations. We conclude that the most likely scenario is continuous acceleration of protons in the solar corona which penetrate the lower solar atmosphere and produce pions that decay into gamma-rays.