Those flashbacks from when Shunpei did the high jump... That was another instance of Shunpei working really hard at improving a skill specifically so he could show off to An. Is that the mental connection she made?
If so, doing the Rubik's cube herself is a way of finding out just how committed Shunpei is to impressing her, or, by extrapolation, just how much he is into her. It kind of connects her to him, like walking in his footsteps. Maybe I'm just being overly fanciful, but I figure the mind goes to strange places when you only get to meet your crush on the bus ride to and from school and you're too awkward to move things forward from there in a natural way. Places like "How much does he love me? I must know. And the only way to possibly find out is by solving this cube."
Or she really is just mad at the cube itself and solving it in an effort to assert dominance, but then what was the purpose of those panels relating to Shunpei's high jump?