TWRP custom recovery makes it quite easy to remove any kind of lock (except for fingerprint) from your Android device.
You'll find a step-by-step guide below:
Reboot your phone into TWRP and click the "Advanced" button
In the advanced options, click on "File Manager"
Navigate to \data\system as seen on screenshots below:
Locate the "gesture.key" or "password.key" file
Long-press on the 'gesture.key' or 'password.key' file to reveal more options and choose "Delete" (if you want the lockscreen to be recoverable afterwards, rename the file extension to ".ke" instead of deleting it)
Confirm the action and after the file has been deleted, just click on "Reboot System"
After you boot into Android, your lockscreen should be removed completely or should accept any pattern/PIN/password you try.
On some devices the lockscreen file can be named differently but it will always have ".key" at the end.