Take a breadboard, connect 5V and ground from Arduino to the power rails of the breadboard.
Connect Ultrasonic Sensor on the breadboard, Vcc and Gnd to the power rail as shown in figure.
Connect Trig and Echo of ultrasonic sensor to the Arduino as mentioned in the code.
Connect two LEDs on the breadboard. Positive Legs of LEDs to the Arduino Pin as mentioned in the code. Negative Legs of LEDs through 330 Ohm resistor to the ground.