[Procedural mesh] Shared or duplicate vertices for different materials of one mesh?

I use a UProceduralMeshComponent->CreateMeshSection_LinearColor and successfully build a procedural scene with one material.

I have an array of all vertices of mesh and several arrays of vertex indices (triangles).

Each array of triangles is a different material.

Can I create a mesh using an array of all vertices only once so that neighboring polygons of different materials use same shared vertices without duplicating vertices?

Or is it necessary to duplicate vertices?

Here is code I had in another engine. How do I do this in UE4?

mesh->vertices = vertices;

mesh->subMeshCount = mats.size();

for (int i = 0; i < mats.size(); i++)
{
    std::vector<int> toa = indices[i];
    mesh->SetTriangles(toa, i);
}