The three-story building in the Flatbush neighborhood of Brooklyn collapsed on Wednesday evening, trapping residents and sparking a major search-and-rescue operation.