I guess I'll be serious here, and give some info for what it's worth. Take it for what you paid for it. I've never shot a charging bear with a handgun. I've taken a Black with a .308, and was the backup shot on a Brown with a 35 Whelen. I've been bluff charged by a brown once, and scared several blacks away from me in the course of my day to day activities.
First thing to avoid a bad encounter with a bear, is understanding their behavior. (actually, the most foolproof way to avoid a bear is to have a bear tag, and it be in season)
1st- Brown Bears:
They VERY rarely see humans as food- only one case I can think of. They avoid humans if they know we are around. The two most common causes of Brown bear attacks are surprising the bear while it is close, and it feels threatened, and a sow protecting her cubs. When in brown bear country, pay attention to the wind, and make noise. I probably look silly, but I talk, whistle, or sing when walking alone where I know brown bears to be. Occasionally, I hear rustling running away from me. I keep my head on a swivel, and stop often to listen. I've seen cubs before, they make noise. I slowly backed up, and went back the way I came.
When attacked by a Brown bear, they are usually only attacking because they feel threatened. Don't scream, curl up in the fetal position, and don't fight back. They will eventually leave (my former Commanding Officer was attacked by a brown while checking his trap line 2 years ago- he did exactly this, and ended up mauled, but alive).
2nd- Black bears:
Black bears are usually very skittish, and will run at the sign of a human (unless they are acclimated to humans). They are, however, curious. They are known to follow hikers down the trail following the scent. Due to this, encounters may be more likely. They tend not to be as protective of their space as Brown bears. However, if a Black Bear is attacking you, he likely sees you as food. Fight back in any way possible (poke eyes, punch snout, etc). A black is less likely to give up until you are bear feces.
Killing them:
Weight of an animal means nothing. An 800 lb moose is very easy to kill. A 100 lb wolverine is not.
A brown bear has very thick fur and skin. Especially when wet, Brown bear fur can slow a bullet down a lot. When choosing a weapon to shoot a brown bear (in defense), you must choose a cartridge that can reach the central nervous system. A bear with a broken shoulder will still kill you. A bear with an exploded heart will still kill you- even if it dies shortly afterwords. Bears have a slow metabolism, and can still function after their lungs and heart stop working for a few minutes. Plenty long enough to still kill you.
Momentum is what reaches the CNS of a bear. Not energy. A heavy for caliber, wide meplat (flat nose) hard cast lead penetrates the deepest and straightest. Since you are aiming for the brain or spinal cord, accuracy is a must. Choose the biggest gun that you can hit a basketball bouncing at you at 35 mph. That caliber is different for all people. For me, I carry a 4" Redhawk in 45 Colt, loaded with 320 gr LFN cast going 1200 fps. This is a tier 3 handload. Some people are more competent with 10mm Glock 20's and some with 454 Casull or bigger.
A Black bear is a relatively thin skinned animal. It does not take as much momentum to reach the CNS of a Black bear. If you feel comfortable shooting a deer with it, it's probably ok for a black bear.
First and foremost is your ability to hit where you are aiming, and to have ready access to your weapon. If it is more then 1-2 seconds from going bang, you might as well not have it. Most bear encounters are that fast.