The Easiest way to check if one array is a subset of another

T

Thriving K.

I want to find the easiest way if one array is a subset of another

for example

A b
[1,2,4,5,6,7,9] [1,3,9] =>true

A b
[1,2,4,5,6,7,9] [1,3,8] =>false
 
G

Gennady Bystritsky

PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBzdXBlcmRpc2Nvbm5lY3RAaG90
bWFpbC5jb20gW21haWx0bzpzdXBlcmRpc2Nvbm5lY3RAaG90bWFpbC5jb21dDQo+IFNlbnQ6IE1v
bmRheSwgQXVndXN0IDAzLCAyMDA5IDEwOjEzIFBNDQo+IFRvOiBydWJ5LXRhbGsgTUwNCj4gU3Vi
amVjdDogVGhlIEVhc2llc3Qgd2F5IHRvIGNoZWNrIGlmIG9uZSBhcnJheSBpcyBhIHN1YnNldCBv
ZiBhbm90aGVyDQo+IA0KPiBJIHdhbnQgdG8gZmluZCB0aGUgZWFzaWVzdCB3YXkgaWYgb25lIGFy
cmF5IGlzIGEgc3Vic2V0IG9mIGFub3RoZXINCj4gDQo+IGZvciBleGFtcGxlDQo+IA0KPiAgQSAg
ICAgICAgICAgICAgICAgICAgYg0KPiBbMSwyLDQsNSw2LDcsOV0gICAgICBbMSwzLDldID0+dHJ1
ZQ0KPiANCj4gIEEgICAgICAgICAgICAgICAgICAgIGINCj4gWzEsMiw0LDUsNiw3LDldICAgICAg
WzEsMyw4XSA9PmZhbHNlDQo+IC0tDQo+IFBvc3RlZCB2aWEgaHR0cDovL3d3dy5ydWJ5LWZvcnVt
LmNvbS8uDQoNCg0KSWYgSSB1bmRlcnN0YW5kIGNvcnJlY3RseSB3aGF0IHlvdSByZWFsbHkgd2Fu
dCwgdGhlIGZpcnN0IGV4YW1wbGUgc2hvdWxkIHByb2R1Y2UgZmFsc2UsIGFzIGFycmF5ICJhIiBk
b2VzIG5vdCBoYXZlIDMuIEFzc3VtaW5nIHRoYXQgeW91IG1lYW50IFsxLDIsMyw0LDUsNiw3LDld
IEkgdGhpbmsgdGhlIGZvbGxvd2luZyB3aWxsIHdvcmsgZm9yIHlvdToNCg0KKGEgJiBiKSA9PSBi
DQoNCkdlbm5hZHkuDQoNCg==
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top