Denver was exactly the wrong team for Stanford to play coming off its 13-day break for final exams.

The Pioneers are maddeningly patient, often wringing every last second of the 35-second shot clock before launching. They also play tough defense.

It didn’t help that Stanford starter Anthony Brown was held out for the opening minutes as his punishment for showing up 10 minutes late for practice Saturday morning. The fifth-year senior had set his alarm clock for PM instead of AM, he said, so he overslept.

In the afternoon, Denver scared the wits out of the Cardinal at Maples Pavilion before Stanford eked out a 49-43 win in the final minute.

Brown made up for his tardiness by scoring a game-high 17 points, including all seven of his team’s points in a run that helped turn the game around in the second half.

Denver’s methodical Princeton-style offense – under former Princeton player Joe Scott – didn’t produce a lot of backdoor layups, but the Pioneers (4-5) hit seven threes to make things interesting.

“When you have five guys on the court that can all shoot, dribble and pass, it’s tough to guard,’’ Brown said. “The matchup zone they played also was a factor.’’

Stanford (5-2) couldn’t get the ball inside regularly to 6-11 Stefan Nastic. “When we can’t do that, we have to settle for jumpers,’’ Brown said.

As a result of oversleeping, he was even more motivated than usual, he said. “There’s no way I’m going to let my team lose this game.’’

Stanford’s Chasson Randle, who entered the game with a team-leading 17.7-point average, had just nine (on 2-for-14 shooting). He didn’t score for the game’s first 23 minutes. But he and Nastic fueled a 9-0 run that turned a 39-36 deficit into a 45-39 advantage with just under minutes left

It was 45-41 when Rosco Allen stole a backdoor pass. Denver thwarted itself when Marcus Byrd, who led Denver with 11 points, committed a turnover and Brett Olson missed a layup. Brown and Randle clinched the outcome at the foul line.

Stanford scored just 17 points in the first half. That would have been fine for its football team, but it was anemic for the hoopers. It was the Cardinal’s lowest output for any half in four years.

Cardinal coach Johnny Dawkins preferred to laud his team’s strong defense rather than harp on its 32 percent shooting.

“That’s one of the best defensive efforts we’ve had since I’ve been here,’’ he said. “To hold them to 43 points, especially with the way they run their offense … I’m just really proud of our guys.’’

He said it’s the first time Brown has been late for anything in five years. Besides that, he said, “he’s always had the ability step up in those moments when things aren’t going well for us.’’