The cost of housing in San Francisco and New York City is infamous for being outrageous, but according to a recent Trulia report, there may be a few hidden gems you could afford in either city.

The trick is knowing where to look.

While both cities have rent-control regulations in places, their policies are completely different.

According to Trulia, renters in Manhattan are more likely to find a rent-stabilized apartment in cheaper neighborhoods, while San Franciscans can find a rent-controlled apartment in neighborhoods with little to no new construction.

Before you start searching high and low for a rent-controlled apartment, first you need to understand what it means.

“A rent-controlled apartment does not prevent a landlord from raising rents. Instead it just 'controls' how much landlords can raise rents over the course of a renter’s tenancy in an apartment,” Trulia stated.

Take New York City for example. The city has two types of rent-increase restrictions: Rent stabilization and rent control.

These Trulia charts show how it works:

Click to enlarge

Housing

(Source: Trulia)

Meanwhile, San Francisco’s rules are a bit easier to understand.

Click to enlarge

Housing

(Source: Trulia)

Armed with this knowledge, Trulia attempted to find prime locations in New York City and San Francisco to live in.

For New York City, Trulia looked at a combination of the 2012 Assessor’s database and its rental listings from the past two years, and estimated the percentage of multi-family rental units that are under rent stabilization for each neighborhood in the Manhattan borough of New York City.

Here are the hidden posts in New York City that you might be able to afford.

Click to enlarge

Trulia

(Source: Trulia)

For San Francisco, Trulia used the 2012 Assessor’s database to estimate the percentage of multifamily rental units that are under rent control for each neighborhood in San Francisco.

Here are the secrets areas in San Francisco that you might be able to live in.

Click to enlarge

Trulia

(Source: Trulia)