Depending on where you're going, you may not be able to bring a gun - it's illegal to bring a gun in Denali Park at least, but I believe most other areas, no issues.
No matter what, I second the suggestion on reading up on bear encounters. If you don't approach them (like any animal, they have a zone of personal space, inside which they'll feel threatened), and keep food out of camp, the odds of an encounter are small. Don't run if you see one - may arouse the predatorial instinct. I backpacked AK for 3 weeks (Glacier Bay, Denali and Wrangell St-Elias) and saw a lot of bear, including both big blacks as well as bigger grizzlies, but we suffered no casualties. If outside Denali, I suppose it couldn't hurt to bring a gun for insurance but I think your best weapon is your wits.