U.S. stocks rose on Tuesday after a two-day decline, helped by gains in technology shares.