1. Correcting Apartment Listings Data
Write a function to correct the num_bedrooms field in apartment listings data. The function should take jsonData as input and return an array of integers representing the corrected num_bedrooms values for each listing. Consider the following rules while correcting the data:
- If 'studio' or '1-bedroom' is immediately preceded by 'yoga', 'dance', or 'art', do not consider it for num_bedrooms value.
- If the description does not contain 'studio' or '1-bedroom', do not change the num_bedrooms value.
- Apply the rules regardless of punctuation or letter casing in the description field.
Provide an explanation for your solution and discuss its time and space complexity.