Prime factorization:
12 = 2 × 2 × 3 = 22 × 3
15 = 3 × 5
18 = 2 × 3 × 3 = 2 × 32
27 = 3 × 3 × 3 = 33
Now,
HCF = Product of smallest power of each common prime factor in the number = 3
LCM = Product of greatest power of each prime factor involved in the number = 22 × 33 × 5 = 540